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

Support Unicode 15.1 for line segmenter #5218

Merged
merged 18 commits into from
Sep 6, 2024

Conversation

makotokato
Copy link
Member

@makotokato makotokato commented Jul 10, 2024

This fix supports Unicode 15.1 for line segmenter. (a part of #3255)

  • Added LB15a handling to engine code since LB15a references previous breaking rules.
  • Adding fallback handling into intermediate status for LB28a
  • Modified tests like Fix Unicode 15.0 line breaking #4389

@makotokato makotokato requested review from eggrobin, aethanyc and robertbastian and removed request for a team, aethanyc, sffc, Manishearth and robertbastian July 10, 2024 11:10
Copy link
Member

@robertbastian robertbastian left a comment

Choose a reason for hiding this comment

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

I'll let someone else review the algorithm

@@ -19,97 +19,111 @@ const UNKNOWN: u8 = 0;
#[allow(dead_code)]
const AI: u8 = 1;
#[allow(dead_code)]
const AL: u8 = 2;
const AK: u8 = 2;
Copy link
Member

Choose a reason for hiding this comment

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

This probably breaks compatibility with current data structs, so you need to bump the version.

Copy link
Member Author

Choose a reason for hiding this comment

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

I have already bumped to V2 for 2.0. Should I bump to V3?

Copy link
Member

Choose a reason for hiding this comment

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

V2 isn't released yet so it's fine as long as long as this only affects V2 structs (looks like dictionary and LSTM are still on V1)

@Manishearth
Copy link
Member

r? @eggrobin for the algorithm

components/segmenter/src/line.rs Outdated Show resolved Hide resolved
components/segmenter/src/line.rs Outdated Show resolved Hide resolved
@robertbastian robertbastian added the waiting-on-author PRs waiting for action from the author for >7 days label Aug 13, 2024
@eggrobin
Copy link
Member

eggrobin commented Sep 4, 2024

I addressed the comments I had made above, moving the LB15a-specific logic into the state table (it is not exactly pretty, we should probably invest in some extensions to the state table description language; but it is nowhere near as bad as the ZWJ-CM situation was).
I also found a few bugs and addressed them, testing this with 200 000 monkeys (last bug found at 8208).
I should probably try 2 000 000 as I did in #4389.

@eggrobin
Copy link
Member

eggrobin commented Sep 4, 2024

I should probably try 2 000 000 as I did in #4389.

fatal error: rustc does not support files larger than 4GB

Maybe we should be using something other than include_str! here.

@eggrobin
Copy link
Member

eggrobin commented Sep 4, 2024

Now tested with 2 000 000 random strings. Before ICU 76 (specifically, before unicode-org/icu#3028) it doesn’t make sense to go further than that, since it turned out the PRNG was cycling around that length (see L2/24-162 §5.6).

@eggrobin eggrobin removed the waiting-on-author PRs waiting for action from the author for >7 days label Sep 5, 2024
Copy link
Member

@robertbastian robertbastian left a comment

Choose a reason for hiding this comment

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

I don't see any issue but cannot confirm that it's correct. Trusting the monkeys

@eggrobin eggrobin merged commit be4c14d into unicode-org:main Sep 6, 2024
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants