Package opennlp.tools.parser
Class ParserModel
- java.lang.Object
-
- opennlp.tools.util.model.BaseModel
-
- opennlp.tools.parser.ParserModel
-
- All Implemented Interfaces:
Serializable
,ArtifactProvider
public class ParserModel extends BaseModel
This is the defaultParserModel
implementation.- See Also:
- 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 ParserModel(File modelFile)
Initializes aParserModel
instance via a validFile
.ParserModel(InputStream in)
Initializes aParserModel
instance via a validInputStream
.ParserModel(String languageCode, MaxentModel buildModel, MaxentModel checkModel, MaxentModel attachModel, POSModel parserTagger, ChunkerModel chunkerTagger, HeadRules headRules, ParserType modelType)
Initializes aParserModel
instance via given parameters.ParserModel(String languageCode, MaxentModel buildModel, MaxentModel checkModel, MaxentModel attachModel, POSModel parserTagger, ChunkerModel chunkerTagger, HeadRules headRules, ParserType modelType, Map<String,String> manifestInfoEntries)
Initializes aParserModel
instance via given parameters.ParserModel(String languageCode, MaxentModel buildModel, MaxentModel checkModel, POSModel parserTagger, ChunkerModel chunkerTagger, HeadRules headRules, ParserType type, Map<String,String> manifestInfoEntries)
Initializes aParserModel
instance via given parameters.ParserModel(URL modelURL)
Initializes aParserModel
instance via a validURL
.ParserModel(Path modelPath)
Initializes aParserModel
instance via a validPath
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
MaxentModel
getAttachModel()
MaxentModel
getBuildModel()
MaxentModel
getCheckModel()
HeadRules
getHeadRules()
ChunkerModel
getParserChunkerModel()
POSModel
getParserTaggerModel()
ParserType
getParserType()
int
hashCode()
ParserModel
updateBuildModel(MaxentModel buildModel)
Instantiates a newParserModel
instance from the existing configuration with the specifiedbuildModel
for exchange.ParserModel
updateCheckModel(MaxentModel checkModel)
Instantiates a newParserModel
instance from the existing configuration with the specifiedcheckModel
for exchange.ParserModel
updateChunkerModel(ChunkerModel chunkModel)
Instantiates a newParserModel
instance from the existing configuration with the specifiedchunkModel
for exchange.ParserModel
updateTaggerModel(POSModel taggerModel)
Instantiates a newParserModel
instance from the existing configuration with the specifiedtaggerModel
for exchange.-
Methods inherited from class opennlp.tools.util.model.BaseModel
getArtifact, getLanguage, getManifestProperty, getVersion, isLoadedFromSerialized, serialize, serialize, serialize
-
-
-
-
Constructor Detail
-
ParserModel
public ParserModel(String languageCode, MaxentModel buildModel, MaxentModel checkModel, MaxentModel attachModel, POSModel parserTagger, ChunkerModel chunkerTagger, HeadRules headRules, ParserType modelType, Map<String,String> manifestInfoEntries)
Initializes aParserModel
instance via given parameters.- Parameters:
languageCode
- An ISO conform language code.buildModel
- A validMaxentModel
used to build.checkModel
- A validMaxentModel
used to check.attachModel
- A validMaxentModel
used to attach.parserTagger
- A validPOSModel
to parse.chunkerTagger
- A validChunkerModel
to chunk.headRules
- TheHeadRules
to to use for parsing.modelType
- TheParserType
to use.manifestInfoEntries
- Additional information kept in the manifest.
-
ParserModel
public ParserModel(String languageCode, MaxentModel buildModel, MaxentModel checkModel, MaxentModel attachModel, POSModel parserTagger, ChunkerModel chunkerTagger, HeadRules headRules, ParserType modelType)
Initializes aParserModel
instance via given parameters.- Parameters:
languageCode
- An ISO conform language code.buildModel
- A validMaxentModel
used to build.checkModel
- A validMaxentModel
used to check.parserTagger
- A validPOSModel
to parse.chunkerTagger
- A validChunkerModel
to chunk.headRules
- TheHeadRules
to to use for parsing.modelType
- TheParserType
to use.
-
ParserModel
public ParserModel(String languageCode, MaxentModel buildModel, MaxentModel checkModel, POSModel parserTagger, ChunkerModel chunkerTagger, HeadRules headRules, ParserType type, Map<String,String> manifestInfoEntries)
Initializes aParserModel
instance via given parameters.- Parameters:
languageCode
- An ISO conform language code.buildModel
- A validMaxentModel
used to build.checkModel
- A validMaxentModel
used to check.parserTagger
- A validPOSModel
to parse.chunkerTagger
- A validChunkerModel
to chunk.headRules
- TheHeadRules
to to use for parsing.type
- TheParserType
to use.manifestInfoEntries
- Additional information kept in the manifest.
-
ParserModel
public ParserModel(InputStream in) throws IOException
Initializes aParserModel
instance via a validInputStream
.- Parameters:
in
- TheInputStream
used for loading the model.- Throws:
IOException
- Thrown if IO errors occurred during initialization.
-
ParserModel
public ParserModel(File modelFile) throws IOException
Initializes aParserModel
instance via a validFile
.- Parameters:
modelFile
- TheFile
used for loading the model.- Throws:
IOException
- Thrown if IO errors occurred during initialization.
-
ParserModel
public ParserModel(Path modelPath) throws IOException
Initializes aParserModel
instance via a validPath
.- Parameters:
modelPath
- ThePath
used for loading the model.- Throws:
IOException
- Thrown if IO errors occurred during initialization.
-
ParserModel
public ParserModel(URL modelURL) throws IOException
Initializes aParserModel
instance via a validURL
.- Parameters:
modelURL
- TheURL
used for loading the model.- Throws:
IOException
- Thrown if IO errors occurred during initialization.
-
-
Method Detail
-
getParserType
public ParserType getParserType()
- Returns:
- Retrieves the
ParserType
as configured in the manifest.
-
getBuildModel
public MaxentModel getBuildModel()
- Returns:
- Retrieves the
build model
as configured in the manifest.
-
getCheckModel
public MaxentModel getCheckModel()
- Returns:
- Retrieves the
check model
as configured in the manifest.
-
getAttachModel
public MaxentModel getAttachModel()
- Returns:
- Retrieves the
attach model
as configured in the manifest.
-
getParserTaggerModel
public POSModel getParserTaggerModel()
- Returns:
- Retrieves the
POSModel
as configured in the manifest.
-
getParserChunkerModel
public ChunkerModel getParserChunkerModel()
- Returns:
- Retrieves the
ChunkerModel
as configured in the manifest.
-
getHeadRules
public HeadRules getHeadRules()
- Returns:
- Retrieves the
HeadRules
as configured in the manifest.
-
updateBuildModel
public ParserModel updateBuildModel(MaxentModel buildModel)
Instantiates a newParserModel
instance from the existing configuration with the specifiedbuildModel
for exchange.- Parameters:
buildModel
- A validMaxentModel
used to build.- Returns:
- A valid
ParserModel
.
-
updateCheckModel
public ParserModel updateCheckModel(MaxentModel checkModel)
Instantiates a newParserModel
instance from the existing configuration with the specifiedcheckModel
for exchange.- Parameters:
checkModel
- A validMaxentModel
used to check.- Returns:
- A valid
ParserModel
.
-
updateTaggerModel
public ParserModel updateTaggerModel(POSModel taggerModel)
Instantiates a newParserModel
instance from the existing configuration with the specifiedtaggerModel
for exchange.- Parameters:
taggerModel
- A validPOSModel
used to tag.- Returns:
- A valid
ParserModel
.
-
updateChunkerModel
public ParserModel updateChunkerModel(ChunkerModel chunkModel)
Instantiates a newParserModel
instance from the existing configuration with the specifiedchunkModel
for exchange.- Parameters:
chunkModel
- A validChunkerModel
used to tag.- Returns:
- A valid
ParserModel
.
-
-