Package opennlp.tools.tokenize
Class TokenizerModel
- java.lang.Object
-
- opennlp.tools.util.model.BaseModel
-
- opennlp.tools.tokenize.TokenizerModel
-
- All Implemented Interfaces:
Serializable
,ArtifactProvider
public final class TokenizerModel extends BaseModel
TheTokenizerModel
is the model used by a learnableTokenizer
.- See Also:
TokenizerME
,TokenizerFactory
, Serialized Form
-
-
Field Summary
-
Fields inherited from class opennlp.tools.util.model.BaseModel
TRAINING_CUTOFF_PROPERTY, TRAINING_EVENTHASH_PROPERTY, TRAINING_ITERATIONS_PROPERTY
-
-
Constructor Summary
Constructors Constructor Description TokenizerModel(File modelFile)
Initializes aTokenizerModel
instance via a validFile
.TokenizerModel(InputStream in)
Initializes aTokenizerModel
instance via a validInputStream
.TokenizerModel(URL modelURL)
Initializes aTokenizerModel
instance via a validURL
.TokenizerModel(Path modelPath)
Initializes aTokenizerModel
instance via a validPath
.TokenizerModel(MaxentModel tokenizerModel, Map<String,String> manifestInfoEntries, TokenizerFactory tokenizerFactory)
Initializes aTokenizerModel
instance via aMaxentModel
and related resources.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
Dictionary
getAbbreviations()
TokenizerFactory
getFactory()
MaxentModel
getMaxentModel()
int
hashCode()
boolean
useAlphaNumericOptimization()
-
Methods inherited from class opennlp.tools.util.model.BaseModel
getArtifact, getLanguage, getManifestProperty, getVersion, isLoadedFromSerialized, serialize, serialize, serialize
-
-
-
-
Constructor Detail
-
TokenizerModel
public TokenizerModel(MaxentModel tokenizerModel, Map<String,String> manifestInfoEntries, TokenizerFactory tokenizerFactory)
Initializes aTokenizerModel
instance via aMaxentModel
and related resources.- Parameters:
tokenizerModel
- Themodel
to be used.manifestInfoEntries
- Additional information kept in the manifest.tokenizerFactory
- TheTokenizerFactory
to be used internally.
-
TokenizerModel
public TokenizerModel(InputStream in) throws IOException
Initializes aTokenizerModel
instance via a validInputStream
.- Parameters:
in
- TheInputStream
used for loading the model.- Throws:
IOException
- Thrown if IO errors occurred during initialization.
-
TokenizerModel
public TokenizerModel(File modelFile) throws IOException
Initializes aTokenizerModel
instance via a validFile
.- Parameters:
modelFile
- TheFile
used for loading the model.- Throws:
IOException
- Thrown if IO errors occurred during initialization.
-
TokenizerModel
public TokenizerModel(Path modelPath) throws IOException
Initializes aTokenizerModel
instance via a validPath
.- Parameters:
modelPath
- ThePath
used for loading the model.- Throws:
IOException
- Thrown if IO errors occurred during initialization.
-
TokenizerModel
public TokenizerModel(URL modelURL) throws IOException
Initializes aTokenizerModel
instance via a validURL
.- Parameters:
modelURL
- TheURL
used for loading the model.- Throws:
IOException
- Thrown if IO errors occurred during initialization.
-
-
Method Detail
-
getFactory
public TokenizerFactory getFactory()
- Returns:
- Retrieves the active
TokenizerFactory
.
-
getMaxentModel
public MaxentModel getMaxentModel()
- Returns:
- Retrieves the model as
MaxentModel
instance.
-
getAbbreviations
public Dictionary getAbbreviations()
- Returns:
- Retrieves the active abbreviation
Dictionary
.
-
useAlphaNumericOptimization
public boolean useAlphaNumericOptimization()
- Returns:
true
if alphanumeric optimization is active,false
otherwise.
-
-