UnicodeWordKind Enum

Specifies whether a segment delimited by the word boundaries of a text is a word, and which kind of word.

public enum UnicodeWordKind

Remarks

The kinds are the rule status values that ICU gives to its word boundaries (UBRK_WORD_NONE, UBRK_WORD_NUMBER, UBRK_WORD_LETTER, UBRK_WORD_KANA and UBRK_WORD_IDEO), from which Intl.Segmenter computes isWordLike: a segment is word-like when its kind is not UnicodeWordKind.None.

The kind is the one of the last character of the segment, ignoring the trailing Extend, Format and ZWJ characters (rule WB4), as in the rules of ICU (word.txt). A low line or another ExtendNumLet character takes the kind of the character before it: a_ is a letter word, 1_ a number, and a low line on its own is not a word.

UnicodeWordEnumerator.CurrentKind gives the kind of each segment of Unicode.EnumerateWordBoundaries.

See also

Fields

NameValueDescription
None0The segment is not a word: spaces, punctuation, symbols, emoji, line breaks (ICU: UBRK_WORD_NONE).
Number1A number: the segment ends with a digit (Word_Break=Numeric), such as 42, 3.14 or a1 (ICU: UBRK_WORD_NUMBER).
Letter2A word of letters, such as hello, can't or 1a: the segment ends with a letter (Word_Break ALetter or Hebrew_Letter, but not a kana or an ideograph), a Hangul syllable, or a letter of a script written without spaces between words, such as Thai (ICU: UBRK_WORD_LETTER).
Kana3Kana: the segment ends with a Hiragana or a Katakana character. ICU defines UBRK_WORD_KANA for them, but its rules give them UBRK_WORD_IDEO, the status of the ideographs.
Ideographic4An ideograph, such as a Han character (Ideographic=Yes), or another Han letter such as the ideographic iteration mark U+3005 (ICU: UBRK_WORD_IDEO).