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

opennlp.tools.util.featuregen

## Class WordClusterDictionary

- java.lang.Object
- - opennlp.tools.util.featuregen.WordClusterDictionary

- All Implemented Interfaces:
    SerializableArtifact

      public class WordClusterDictionary
      extends Object
      implements SerializableArtifact

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `WordClusterDictionary.WordClusterDictionarySerializer`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `WordClusterDictionary(InputStream in)` Read word2vec and clark clustering style lexicons.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Class<?>` | `getArtifactSerializerClass()` Retrieves the class which can serialize and recreate this artifact.
    `String` | `lookupToken(String string)`
    `void` | `serialize(OutputStream out)`

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

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

- - ### Constructor Detail

    - #### WordClusterDictionary

          public WordClusterDictionary(InputStream in)
                                throws IOException

      Read word2vec and clark clustering style lexicons.
      Parameters:
        `in` - the inputstream
      Throws:
        `IOException` - the io exception

  - ### Method Detail

    - #### lookupToken

          public String lookupToken(String string)

    - #### serialize

          public void serialize(OutputStream out)
                         throws IOException

      Throws:
        `IOException`

    - #### getArtifactSerializerClass

          public Class<?> getArtifactSerializerClass()

      Description copied from interface: `SerializableArtifact`
      Retrieves the class which can serialize and recreate this artifact.
      Note: The serializer class must have a public zero argument constructor or an exception is thrown during model serialization/loading.
      Specified by:
        `getArtifactSerializerClass` in interface `SerializableArtifact`
      Returns:
        the corresponding ArtifactSerializer class.

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