Package opennlp.tools.util.normalizer
Class CodePoints
java.lang.Object
opennlp.tools.util.normalizer.CodePoints
Shared code-point decoding for forward (and reverse) cursor scans over
CharSequence text.
A char that is not a high surrogate is treated as its own code point, so BMP text
decodes without Character.codePointAt(CharSequence, int) on every step.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final recordA code point at an index together with its UTF-16 width. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static CodePoints.Atat(CharSequence text, int index) Reads the code point starting atindex.(package private) static CodePoints.Atbefore(CharSequence text, int index) Reads the code point ending atindex(exclusive end offset).
-
Constructor Details
-
CodePoints
private CodePoints()
-
-
Method Details
-
at
Reads the code point starting atindex.- Parameters:
text- The text.index- The UTF-16 index; must be in[0, text.length()).- Returns:
- The decoded code point and its char width.
-
before
Reads the code point ending atindex(exclusive end offset).- Parameters:
text- The text.index- The UTF-16 index after the code point; must be in(0, text.length()].- Returns:
- The decoded code point and its char width.
-