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

opennlp.tools.parser.chunking

## Class BuildContextGenerator

- java.lang.Object
- - opennlp.tools.parser.AbstractContextGenerator
  - - opennlp.tools.parser.chunking.BuildContextGenerator

-     public class BuildContextGenerator
      extends AbstractContextGenerator

  Class to generator predictive contexts for deciding how constituents should be combined together.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BuildContextGenerator()` Creates a new context generator for making decisions about combining constitients togehter.
    `BuildContextGenerator(Dictionary dict)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String[]` | `getContext(Object o)`
    `String[]` | `getContext(Parse[] constituents, int index)` Returns the predictive context used to determine how constituent at the specified index should be combined with other contisuents.

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

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

- - ### Constructor Detail

    - #### BuildContextGenerator

          public BuildContextGenerator()

      Creates a new context generator for making decisions about combining constitients togehter.

    - #### BuildContextGenerator

          public BuildContextGenerator(Dictionary dict)

  - ### Method Detail

    - #### getContext

          public String[] getContext(Object o)

    - #### getContext

          public String[] getContext(Parse[] constituents,
                                     int index)

      Returns the predictive context used to determine how constituent at the specified index should be combined with other contisuents.
      Parameters:
        `constituents` - The constituents which have yet to be combined into new constituents.
        `index` - The index of the constituent whcihi is being considered.
      Returns:
        the context for building constituents at the specified index.

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