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

opennlp.tools.parser.treeinsert

## Class BuildContextGenerator

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

-     public class BuildContextGenerator
      extends AbstractContextGenerator

  Creates the features or contexts for the building phase of parsing. This phase builds constituents from the left-most node of these constituents.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BuildContextGenerator()`

  - ### 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 contexts/features for the decision to build a new constituent for the specified parse at the specified index.

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

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

- - ### Constructor Detail

    - #### BuildContextGenerator

          public BuildContextGenerator()

  - ### Method Detail

    - #### getContext

          public String[] getContext(Object o)

    - #### getContext

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

      Returns the contexts/features for the decision to build a new constituent for the specified parse at the specified index.
      Parameters:
        `constituents` - The constituents of the parse so far.
        `index` - The index of the constituent where a build decision is being made.
      Returns:
        the contexts/features for the decision to build a new constituent.

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