Class ChunkerModel
java.lang.Object
opennlp.tools.util.model.BaseModel
opennlp.tools.chunker.ChunkerModel
- All Implemented Interfaces:
Serializable, ArtifactProvider
The
ChunkerModel is the model used by a learnable Chunker.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final Stringprivate static final Stringprivate static final longFields inherited from class BaseModel
artifactMap, FACTORY_NAME, MANIFEST_ENTRY, toolFactory, TRAINING_CUTOFF_PROPERTY, TRAINING_EVENTHASH_PROPERTY, TRAINING_ITERATIONS_PROPERTY -
Constructor Summary
ConstructorsConstructorDescriptionChunkerModel(File modelFile) Initializes aChunkerModelinstance via a validFile.Initializes aChunkerModelinstance via a validInputStream.ChunkerModel(String languageCode, MaxentModel chunkerModel, int beamSize, Map<String, String> manifestInfoEntries, ChunkerFactory factory) Initializes aChunkerModelinstance via given parameters.ChunkerModel(String languageCode, MaxentModel chunkerModel, Map<String, String> manifestInfoEntries, ChunkerFactory factory) Initializes aChunkerModelinstance via given parameters.ChunkerModel(String languageCode, MaxentModel chunkerModel, ChunkerFactory factory) Initializes aChunkerModelinstance via given parameters.ChunkerModel(String languageCode, SequenceClassificationModel chunkerModel, Map<String, String> manifestInfoEntries, ChunkerFactory factory) Initializes aChunkerModelinstance via given parameters.ChunkerModel(URL modelURL) Initializes aChunkerModelinstance via a validURL.ChunkerModel(Path modelPath) Initializes aChunkerModelinstance via a validPath. -
Method Summary
Modifier and TypeMethodDescriptionprotected Class<? extends BaseToolFactory> Subclasses should override this method if their module has a defaultBaseToolFactorysubclass.protected voidValidates the parsed artifacts.Methods inherited from class BaseModel
checkArtifactMap, createArtifactSerializers, createArtifactSerializers, deserialize, getArtifact, getArtifactSerializer, getLanguage, getManifestProperty, getVersion, isLoadedFromSerialized, serialize, serialize, serialize, setManifestProperty, skipEntryForSerialization
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
COMPONENT_NAME
- See Also:
-
CHUNKER_MODEL_ENTRY_NAME
- See Also:
-
-
Constructor Details
-
ChunkerModel
public ChunkerModel(String languageCode, SequenceClassificationModel chunkerModel, Map<String, String> manifestInfoEntries, ChunkerFactory factory) Initializes aChunkerModelinstance via given parameters.- Parameters:
languageCode- An ISO conform language code.chunkerModel- A validSequenceClassificationModel.manifestInfoEntries- Additional information kept in the manifest.factory- TheChunkerFactoryfor creating related objects.
-
ChunkerModel
public ChunkerModel(String languageCode, MaxentModel chunkerModel, Map<String, String> manifestInfoEntries, ChunkerFactory factory) Initializes aChunkerModelinstance via given parameters.- Parameters:
languageCode- An ISO conform language code.chunkerModel- A validMaxentModel.manifestInfoEntries- Additional information kept in the manifest.factory- TheChunkerFactoryfor creating related objects.
-
ChunkerModel
public ChunkerModel(String languageCode, MaxentModel chunkerModel, int beamSize, Map<String, String> manifestInfoEntries, ChunkerFactory factory) Initializes aChunkerModelinstance via given parameters.- Parameters:
languageCode- An ISO conform language code.chunkerModel- A validMaxentModel.beamSize- The size of the beam that should be used when decoding sequences.manifestInfoEntries- Additional information kept in the manifest.factory- TheChunkerFactoryfor creating related objects.
-
ChunkerModel
Initializes aChunkerModelinstance via given parameters.- Parameters:
languageCode- An ISO conform language code.chunkerModel- A validMaxentModel.factory- TheChunkerFactoryfor creating related objects.
-
ChunkerModel
Initializes aChunkerModelinstance via a validInputStream.- Parameters:
in- TheInputStreamused for loading the model.- Throws:
IOException- Thrown if IO errors occurred during initialization.
-
ChunkerModel
Initializes aChunkerModelinstance via a validFile.- Parameters:
modelFile- TheFileused for loading the model.- Throws:
IOException- Thrown if IO errors occurred during initialization.
-
ChunkerModel
Initializes aChunkerModelinstance via a validPath.- Parameters:
modelPath- ThePathused for loading the model.- Throws:
IOException- Thrown if IO errors occurred during initialization.
-
ChunkerModel
Initializes aChunkerModelinstance via a validURL.- Parameters:
modelURL- TheURLused for loading the model.- Throws:
IOException- Thrown if IO errors occurred during initialization.
-
-
Method Details
-
validateArtifactMap
Description copied from class:BaseModelValidates the parsed artifacts. If something is not valid, subclasses should throw anInvalidFormatException.Note: Subclasses should generally invoke
super.validateArtifactMapat the beginning of this method.- Overrides:
validateArtifactMapin classBaseModel- Throws:
InvalidFormatException- Thrown if artifacts were found to be inconsistent.
-
getChunkerSequenceModel
- Returns:
- Retrieves a
SequenceClassificationModel.
-
getDefaultFactory
Description copied from class:BaseModelSubclasses should override this method if their module has a defaultBaseToolFactorysubclass.- Overrides:
getDefaultFactoryin classBaseModel- Returns:
- The default
BaseToolFactoryfor the component, ornullif none.
-
getFactory
- Returns:
- Retrieves the active
ChunkerFactory.
-