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

opennlp.tools.tokenize

## Interface TokenContextGenerator

- All Known Implementing Classes:
    DefaultTokenContextGenerator

      public interface TokenContextGenerator

  Interface for `TokenizerME` context generators.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `String[]` | `getContext(String sentence, int index)` Returns an array of features for the specified sentence string at the specified index.

- - ### Method Detail

    - #### getContext

          String[] getContext(String sentence,
                              int index)

      Returns an array of features for the specified sentence string at the specified index.
      Parameters:
        `sentence` - The string for a sentence.
        `index` - The index to consider splitting as a token.
      Returns:
        an array of features for the specified sentence string at the specified index.

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