Created
September 13, 2021 17:39
-
-
Save seanghay/722427c618d2f35da76f6d5dc33a7ec2 to your computer and use it in GitHub Desktop.
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
| const segmenter = new Intl.Segmenter("km", {granularity: "word"}); | |
| const input = "នឹកបងឬនឹកគេ?"; | |
| const segments = segmenter.segment(input); | |
| for (const {segment} of segments) { | |
| console.log(segment) | |
| } | |
| // OUTPUT: | |
| // នឹក | |
| // បង | |
| // ឬ | |
| // នឹក | |
| // គេ | |
| // ? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment