TokenNameFinderModel (Apache OpenNLP Tools 1.9.5 API)
Date: 2026-06-18

opennlp.tools.namefind

## Class TokenNameFinderModel

- java.lang.Object
- - opennlp.tools.util.model.BaseModel
  - - opennlp.tools.namefind.TokenNameFinderModel

- All Implemented Interfaces:
    Serializable, ArtifactProvider

      public class TokenNameFinderModel
      extends BaseModel

  The `TokenNameFinderModel` is the model used by a learnable `TokenNameFinder`.
  See Also:
    `NameFinderME`, Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `TokenNameFinderModel.FeatureGeneratorCreationError`

  - ### Field Summary

    - ### Fields inherited from class opennlp.tools.util.model.BaseModel

      `TRAINING_CUTOFF_PROPERTY, TRAINING_EVENTHASH_PROPERTY, TRAINING_ITERATIONS_PROPERTY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TokenNameFinderModel(File modelFile)`
    `TokenNameFinderModel(InputStream in)`
    `TokenNameFinderModel(Path modelPath)`
    `TokenNameFinderModel(String languageCode, MaxentModel nameFinderModel, byte[] generatorDescriptor, Map<String,Object> resources, Map<String,String> manifestInfoEntries)`
    `TokenNameFinderModel(String languageCode, MaxentModel nameFinderModel, int beamSize, byte[] generatorDescriptor, Map<String,Object> resources, Map<String,String> manifestInfoEntries, SequenceCodec<String> seqCodec, TokenNameFinderFactory factory)`
    `TokenNameFinderModel(String languageCode, MaxentModel nameFinderModel, Map<String,Object> resources, Map<String,String> manifestInfoEntries)`
    `TokenNameFinderModel(String languageCode, SequenceClassificationModel<String> nameFinderModel, byte[] generatorDescriptor, Map<String,Object> resources, Map<String,String> manifestInfoEntries, SequenceCodec<String> seqCodec, TokenNameFinderFactory factory)`
    `TokenNameFinderModel(URL modelURL)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Map<String,ArtifactSerializer>` | `createArtifactSerializers()` Create the artifact serializers.
    `TokenNameFinderFactory` | `getFactory()`
    `SequenceClassificationModel<String>` | `getNameFinderSequenceModel()`
    `SequenceCodec<String>` | `getSequenceCodec()`

    - ### Methods inherited from class opennlp.tools.util.model.BaseModel

      `getArtifact, getLanguage, getManifestProperty, getVersion, isLoadedFromSerialized, serialize, serialize, serialize`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TokenNameFinderModel

          public TokenNameFinderModel(String languageCode,
                                      SequenceClassificationModel<String> nameFinderModel,
                                      byte[] generatorDescriptor,
                                      Map<String,Object> resources,
                                      Map<String,String> manifestInfoEntries,
                                      SequenceCodec<String> seqCodec,
                                      TokenNameFinderFactory factory)

    - #### TokenNameFinderModel

          public TokenNameFinderModel(String languageCode,
                                      MaxentModel nameFinderModel,
                                      int beamSize,
                                      byte[] generatorDescriptor,
                                      Map<String,Object> resources,
                                      Map<String,String> manifestInfoEntries,
                                      SequenceCodec<String> seqCodec,
                                      TokenNameFinderFactory factory)

    - #### TokenNameFinderModel

          public TokenNameFinderModel(String languageCode,
                                      MaxentModel nameFinderModel,
                                      byte[] generatorDescriptor,
                                      Map<String,Object> resources,
                                      Map<String,String> manifestInfoEntries)

    - #### TokenNameFinderModel

          public TokenNameFinderModel(String languageCode,
                                      MaxentModel nameFinderModel,
                                      Map<String,Object> resources,
                                      Map<String,String> manifestInfoEntries)

    - #### TokenNameFinderModel

          public TokenNameFinderModel(InputStream in)
                               throws IOException

      Throws:
        `IOException`

    - #### TokenNameFinderModel

          public TokenNameFinderModel(File modelFile)
                               throws IOException

      Throws:
        `IOException`

    - #### TokenNameFinderModel

          public TokenNameFinderModel(Path modelPath)
                               throws IOException

      Throws:
        `IOException`

    - #### TokenNameFinderModel

          public TokenNameFinderModel(URL modelURL)
                               throws IOException

      Throws:
        `IOException`

  - ### Method Detail

    - #### getNameFinderSequenceModel

          public SequenceClassificationModel<String> getNameFinderSequenceModel()

    - #### getSequenceCodec

          public SequenceCodec<String> getSequenceCodec()

    - #### getFactory

          public TokenNameFinderFactory getFactory()

    - #### createArtifactSerializers

          public static Map<String,ArtifactSerializer> createArtifactSerializers()

      Create the artifact serializers. Currently for serializers related to features that require external resources, such as `W2VClassesDictionary` objects, the convention is to add its element tag name as key of the serializer map. For example, the element tag name for the `WordClusterFeatureGenerator` which uses `W2VClassesDictionary` objects serialized by the `W2VClassesDictionarySerializer` is 'wordcluster', which is the key used to add the serializer to the map.
      Returns:
        the map containing the added serializers

Copyright © 2026 The Apache Software Foundation. All rights reserved.