-
Notifications
You must be signed in to change notification settings - Fork 512
Add Intl.Segmenter support #539
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b09babd
Add Intl.Segmenter support and some initial tests. (Missing docs, cov…
ExplodingCabbage 714de4c
Get to 100% coverage
ExplodingCabbage b998ddd
Document intlSegmenter
ExplodingCabbage bd052a3
Improve docs
ExplodingCabbage e703307
Add release notes
ExplodingCabbage File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, @ExplodingCabbage, I'm Chinese, I can confirm that the meaning of these two sentences are correct.
But I'm not sure about the test purpose here.
I can see that
Not sure why '我有' are together, but '梅', '有' are separated, if you want test something similar you can change
梅有
to他有
(He has) or她有
(She has).Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's quite strange...
'她' and '他' are the same, but one for male, one for female.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh. What I wanted to demonstrate was that the "tokens" we split the text into are what a Chinese speaker or linguist would consider to be single words. But from what you write, it sounds like the tokens in this case aren't what you'd consider words, though, and
Intl.Segmenter
is giving an incorrect result? i.e. if I understand you right, you would say "我有" is two words ("我" and "有"), not a single word made up of two characters? Is there any kind of ambiguity about this - like, is there any reason a native speaker might argue that 我有 is a single word - or isIntl.Segmenter
just completely unambiguously wrong here?If so, it's probably worth a bug report to... whatever the underlying source of the segmentation rules is here. (ICU, I think.)
Anyway, for clarity I'll tweak this test to show an example where
Intl.Segmenter
manages to get the tokenization right. Thank you for commenting!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not something really "incorrect", people have different opinions. Just feels odd, it's inconsistent for things similar.