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

opennlp.tools.util

## Interface BeamSearchContextGenerator<T>

- All Known Subinterfaces:
    ChunkerContextGenerator, LemmatizerContextGenerator, NameContextGenerator, POSContextGenerator
  All Known Implementing Classes:
    ChunkContextGenerator, ConfigurablePOSContextGenerator, DefaultChunkerContextGenerator, DefaultLemmatizerContextGenerator, DefaultNameContextGenerator, DefaultPOSContextGenerator

      public interface BeamSearchContextGenerator<T>

  Interface for context generators used with a sequence beam search.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `String[]` | `getContext(int index, T[] sequence, String[] priorDecisions, Object[] additionalContext)` Returns the context for the specified position in the specified sequence (list).

- - ### Method Detail

    - #### getContext

          String[] getContext(int index,
                              T[] sequence,
                              String[] priorDecisions,
                              Object[] additionalContext)

      Returns the context for the specified position in the specified sequence (list).
      Parameters:
        `index` - The index of the sequence.
        `sequence` - The sequence of items over which the beam search is performed.
        `priorDecisions` - The sequence of decisions made prior to the context for which this decision is being made.
        `additionalContext` - Any addition context specific to a class implementing this interface.
      Returns:
        the context for the specified position in the specified sequence.

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