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 defaultParserModelimplementation.- 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 aParserModelinstance via a validFile.ParserModel(InputStream in)Initializes aParserModelinstance via a validInputStream.ParserModel(String languageCode, MaxentModel buildModel, MaxentModel checkModel, MaxentModel attachModel, POSModel parserTagger, ChunkerModel chunkerTagger, HeadRules headRules, ParserType modelType)Initializes aParserModelinstance 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 aParserModelinstance via given parameters.ParserModel(String languageCode, MaxentModel buildModel, MaxentModel checkModel, POSModel parserTagger, ChunkerModel chunkerTagger, HeadRules headRules, ParserType type, Map<String,String> manifestInfoEntries)Initializes aParserModelinstance via given parameters.ParserModel(URL modelURL)Initializes aParserModelinstance via a validURL.ParserModel(Path modelPath)Initializes aParserModelinstance via a validPath.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)MaxentModelgetAttachModel()MaxentModelgetBuildModel()MaxentModelgetCheckModel()HeadRulesgetHeadRules()ChunkerModelgetParserChunkerModel()POSModelgetParserTaggerModel()ParserTypegetParserType()inthashCode()ParserModelupdateBuildModel(MaxentModel buildModel)Instantiates a newParserModelinstance from the existing configuration with the specifiedbuildModelfor exchange.ParserModelupdateCheckModel(MaxentModel checkModel)Instantiates a newParserModelinstance from the existing configuration with the specifiedcheckModelfor exchange.ParserModelupdateChunkerModel(ChunkerModel chunkModel)Instantiates a newParserModelinstance from the existing configuration with the specifiedchunkModelfor exchange.ParserModelupdateTaggerModel(POSModel taggerModel)Instantiates a newParserModelinstance from the existing configuration with the specifiedtaggerModelfor 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 aParserModelinstance via given parameters.- Parameters:
languageCode- An ISO conform language code.buildModel- A validMaxentModelused to build.checkModel- A validMaxentModelused to check.attachModel- A validMaxentModelused to attach.parserTagger- A validPOSModelto parse.chunkerTagger- A validChunkerModelto chunk.headRules- TheHeadRulesto to use for parsing.modelType- TheParserTypeto 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 aParserModelinstance via given parameters.- Parameters:
languageCode- An ISO conform language code.buildModel- A validMaxentModelused to build.checkModel- A validMaxentModelused to check.parserTagger- A validPOSModelto parse.chunkerTagger- A validChunkerModelto chunk.headRules- TheHeadRulesto to use for parsing.modelType- TheParserTypeto use.
-
ParserModel
public ParserModel(String languageCode, MaxentModel buildModel, MaxentModel checkModel, POSModel parserTagger, ChunkerModel chunkerTagger, HeadRules headRules, ParserType type, Map<String,String> manifestInfoEntries)
Initializes aParserModelinstance via given parameters.- Parameters:
languageCode- An ISO conform language code.buildModel- A validMaxentModelused to build.checkModel- A validMaxentModelused to check.parserTagger- A validPOSModelto parse.chunkerTagger- A validChunkerModelto chunk.headRules- TheHeadRulesto to use for parsing.type- TheParserTypeto use.manifestInfoEntries- Additional information kept in the manifest.
-
ParserModel
public ParserModel(InputStream in) throws IOException
Initializes aParserModelinstance via a validInputStream.- Parameters:
in- TheInputStreamused for loading the model.- Throws:
IOException- Thrown if IO errors occurred during initialization.
-
ParserModel
public ParserModel(File modelFile) throws IOException
Initializes aParserModelinstance via a validFile.- Parameters:
modelFile- TheFileused for loading the model.- Throws:
IOException- Thrown if IO errors occurred during initialization.
-
ParserModel
public ParserModel(Path modelPath) throws IOException
Initializes aParserModelinstance via a validPath.- Parameters:
modelPath- ThePathused for loading the model.- Throws:
IOException- Thrown if IO errors occurred during initialization.
-
ParserModel
public ParserModel(URL modelURL) throws IOException
Initializes aParserModelinstance via a validURL.- Parameters:
modelURL- TheURLused for loading the model.- Throws:
IOException- Thrown if IO errors occurred during initialization.
-
-
Method Detail
-
getParserType
public ParserType getParserType()
- Returns:
- Retrieves the
ParserTypeas configured in the manifest.
-
getBuildModel
public MaxentModel getBuildModel()
- Returns:
- Retrieves the
build modelas configured in the manifest.
-
getCheckModel
public MaxentModel getCheckModel()
- Returns:
- Retrieves the
check modelas configured in the manifest.
-
getAttachModel
public MaxentModel getAttachModel()
- Returns:
- Retrieves the
attach modelas configured in the manifest.
-
getParserTaggerModel
public POSModel getParserTaggerModel()
- Returns:
- Retrieves the
POSModelas configured in the manifest.
-
getParserChunkerModel
public ChunkerModel getParserChunkerModel()
- Returns:
- Retrieves the
ChunkerModelas configured in the manifest.
-
getHeadRules
public HeadRules getHeadRules()
- Returns:
- Retrieves the
HeadRulesas configured in the manifest.
-
updateBuildModel
public ParserModel updateBuildModel(MaxentModel buildModel)
Instantiates a newParserModelinstance from the existing configuration with the specifiedbuildModelfor exchange.- Parameters:
buildModel- A validMaxentModelused to build.- Returns:
- A valid
ParserModel.
-
updateCheckModel
public ParserModel updateCheckModel(MaxentModel checkModel)
Instantiates a newParserModelinstance from the existing configuration with the specifiedcheckModelfor exchange.- Parameters:
checkModel- A validMaxentModelused to check.- Returns:
- A valid
ParserModel.
-
updateTaggerModel
public ParserModel updateTaggerModel(POSModel taggerModel)
Instantiates a newParserModelinstance from the existing configuration with the specifiedtaggerModelfor exchange.- Parameters:
taggerModel- A validPOSModelused to tag.- Returns:
- A valid
ParserModel.
-
updateChunkerModel
public ParserModel updateChunkerModel(ChunkerModel chunkModel)
Instantiates a newParserModelinstance from the existing configuration with the specifiedchunkModelfor exchange.- Parameters:
chunkModel- A validChunkerModelused to tag.- Returns:
- A valid
ParserModel.
-
-