public class TextTerminator extends java.lang.Object implements TextProcessor
TextProcessor
that adds a beginning of string and end of string token.Constructor and Description |
---|
TextTerminator()
Constructs a default
TextTerminator . |
TextTerminator(boolean addBosToken,
boolean addEosToken)
Constructs a
TextTerminator using the default tokens. |
TextTerminator(boolean addBosToken,
boolean addEosToken,
java.lang.String bosToken,
java.lang.String eosToken)
Constructs a
TextTerminator . |
Modifier and Type | Method and Description |
---|---|
java.util.List<java.lang.String> |
preprocess(java.util.List<java.lang.String> tokens)
Applies the preprocessing defined to the given input tokens.
|
public TextTerminator()
TextTerminator
.public TextTerminator(boolean addBosToken, boolean addEosToken)
TextTerminator
using the default tokens.addBosToken
- true to add a beginning of text tokenaddEosToken
- true to add an end of text tokenpublic TextTerminator(boolean addBosToken, boolean addEosToken, java.lang.String bosToken, java.lang.String eosToken)
TextTerminator
.addBosToken
- true to add a beginning of text tokenaddEosToken
- true to add an end of text tokenbosToken
- the token to add to the beginning of the texteosToken
- the token to add to the end of the textpublic java.util.List<java.lang.String> preprocess(java.util.List<java.lang.String> tokens)
preprocess
in interface TextProcessor
tokens
- the tokens created after the input text is tokenized