Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for NFKD and the decomposed counterpart of UTS 46 without ignored and disallowed #1967

Merged
merged 10 commits into from
Jun 2, 2022

Conversation

hsivonen
Copy link
Member

I plan to consolidate the complex decomposition expansion tables between the normalization forms.

…without ignoring default ignorables

Default ignorables are not ignored, because doing so would violate the fundamental assumption
of the normalizes that every input character produces non-empty output.

The expectation is that real NFKC_CaseFold will be implemented by first filtering out default ignorables
and then plugging the NFKD_CaseFold data into the upcoming `ComposingNormalizer` code that will turn
NFD into NFC and NFKD into NFKC.
@hsivonen hsivonen added the C-collator Component: Collation, normalization label May 30, 2022
@hsivonen hsivonen self-assigned this May 30, 2022
@hsivonen hsivonen added this to the ICU4X 1.0 (Features) milestone May 30, 2022
@hsivonen hsivonen added the S-medium Size: Less than a week (larger bug fix or enhancement) label May 30, 2022
@hsivonen
Copy link
Member Author

hsivonen commented May 30, 2022

Copying the extended commit message here:

Default ignorables are not ignored, because doing so would violate the fundamental assumption of the normalizer that every input character produces non-empty output.

The expectation is that real NFKC_CaseFold will be implemented by first filtering out default ignorables and then plugging the NFKD_CaseFold data into the upcoming ComposingNormalizer code that will turn NFD into NFC and NFKD into NFKC.

Saves 7332 bytes in data size.
@hsivonen
Copy link
Member Author

The second changeset saves 7332 bytes in data size compared to the first changeset. The second changeset also reduces pointer chasing in the iterators my making the fields hold things more directly.

@Manishearth Manishearth removed request for a team and Manishearth May 31, 2022 15:15
sffc
sffc previously approved these changes Jun 1, 2022
Copy link
Member

@sffc sffc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Praise: Looks good from a data perspective. @echeran will review from an algorithmic perspective.

@hsivonen
Copy link
Member Author

hsivonen commented Jun 1, 2022

Since I needed to make another push to merge main, I also pushed another commit that documents further data size optimizations at the expense of run-time branches. After writing that, avoiding those run-time branches starts feeling a bit silly, and I feel I should proceed with further data size optimizations. @echeran, @sffc, what do you think? (In any case, let's land this first.)

sffc
sffc previously approved these changes Jun 1, 2022
@hsivonen
Copy link
Member Author

hsivonen commented Jun 1, 2022

After writing that, avoiding those run-time branches starts feeling a bit silly, and I feel I should proceed with further data size optimizations.

Thinking about this more, the supplementary set idea doesn't make sense compared to hard-coding the exceptions: when a characters decomposes to a non-starter in a way that's not the character itself, that decomposition is hard-coded anyway, so it doesn't make sense for the set extension to be more generic.

@hsivonen
Copy link
Member Author

hsivonen commented Jun 2, 2022

The "binsize (wasm)" failure looks like an infra failure: Extracting a tar file fails.

@hsivonen hsivonen changed the title Add support for NFKD and the decomposed counterpart of NFKC_CaseFold without ignoring default ignorables Add support for NFKD and the decomposed counterpart of UTS 46 without ignored and disallowed Jun 2, 2022
Copy link
Contributor

@echeran echeran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@echeran echeran merged commit a3ba544 into unicode-org:main Jun 2, 2022
@echeran
Copy link
Contributor

echeran commented Jun 2, 2022

Squash-merged on behalf of @hsivonen at his request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-collator Component: Collation, normalization S-medium Size: Less than a week (larger bug fix or enhancement)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants