BrownCluster (Apache OpenNLP :: Core :: Runtime 3.0.0-M4 API)
Description: declaration: package: opennlp.tools.util.featuregen, class: BrownCluster

Package opennlp.tools.util.featuregen

# Class BrownCluster

java.lang.Object
opennlp.tools.util.featuregen.BrownCluster

All Implemented Interfaces:
  `opennlp.tools.util.model.SerializableArtifact`

public class BrownCluster extends Object implements opennlp.tools.util.model.SerializableArtifact
Class to load a Brown cluster document in the format: `word\tword_class\tprob`.

Originally available at: http://metaoptimize.com/projects/wordreprs/.

Further details can be found in the related research paper.

The file containing the clustering lexicon has to be passed as the value of the dict attribute of each `BrownCluster` feature generator.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `BrownCluster.BrownClusterSerializer`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `BrownCluster(InputStream in)`
  Instatiates a `BrownCluster` and its related token to cluster map via an `InputStream`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Class<?>`
  `getArtifactSerializerClass()`
  `String`
  `lookupToken(String string)`
  Check if a token is in the Brown:paths, token map.
  `void`
  `serialize(OutputStream out)`

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

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

- ## Constructor Details

  - ### BrownCluster

    public BrownCluster(InputStream in) throws IOException
    Instatiates a `BrownCluster` and its related token to cluster map via an `InputStream`.
    Parameters:
      `in` - A valid, open `InputStream` to read from.
    Throws:
      `IOException` - Thrown if errors occurred reading from `in`.

- ## Method Details

  - ### lookupToken

    public String lookupToken(String string)
    Check if a token is in the Brown:paths, token map.
    Parameters:
      `string` - the token to look-up
    Returns:
      the brown class if such token is in the brown cluster map.

  - ### serialize

    public void serialize(OutputStream out) throws IOException
    Throws:
      `IOException`

  - ### getArtifactSerializerClass

    public Class<?> getArtifactSerializerClass()
    Specified by:
      `getArtifactSerializerClass` in interface `opennlp.tools.util.model.SerializableArtifact`