Package opennlp.tools.tokenize
Class WhitespaceTokenizer
- java.lang.Object
-
- opennlp.tools.tokenize.WhitespaceTokenizer
-
-
Field Summary
Fields Modifier and Type Field Description static WhitespaceTokenizerINSTANCEUse this static reference to retrieve an instance of theWhitespaceTokenizer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidsetKeepNewLines(boolean keepNewLines)Switches whether to keep new lines or not.String[]tokenize(String s)Splits a string into its atomic parts.Span[]tokenizePos(String d)Finds the boundaries of atomic parts in a string.
-
-
-
Field Detail
-
INSTANCE
public static final WhitespaceTokenizer INSTANCE
Use this static reference to retrieve an instance of theWhitespaceTokenizer.
-
-
Method Detail
-
tokenizePos
public Span[] tokenizePos(String d)
Description copied from interface:TokenizerFinds the boundaries of atomic parts in a string.- Parameters:
d- The string to be tokenized.- Returns:
- The
spans (offsets into {@code s})for each token as the individuals array elements.
-
tokenize
public String[] tokenize(String s)
Description copied from interface:TokenizerSplits a string into its atomic parts.
-
setKeepNewLines
public void setKeepNewLines(boolean keepNewLines)
Switches whether to keep new lines or not.- Parameters:
keepNewLines-Trueif new lines are kept,falseotherwise.
-
-