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

opennlp.tools.postag

## Interface POSContextGenerator

- All Superinterfaces:
    BeamSearchContextGenerator<String>
  All Known Implementing Classes:
    ConfigurablePOSContextGenerator, DefaultPOSContextGenerator

      public interface POSContextGenerator
      extends BeamSearchContextGenerator<String>

  The interface for a context generator for the POS Tagger.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `String[]` | `getContext(int pos, String[] tokens, String[] prevTags, Object[] ac)` Returns the context for the specified position in the specified sequence (list).

- - ### Method Detail

    - #### getContext

          String[] getContext(int pos,
                              String[] tokens,
                              String[] prevTags,
                              Object[] ac)

      Description copied from interface: `BeamSearchContextGenerator`
      Returns the context for the specified position in the specified sequence (list).
      Specified by:
        `getContext` in interface `BeamSearchContextGenerator<String>`
      Parameters:
        `pos` - The index of the sequence.
        `tokens` - The sequence of items over which the beam search is performed.
        `prevTags` - The sequence of decisions made prior to the context for which this decision is being made.
        `ac` - 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.