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

opennlp.tools.ml.maxent

## Class BasicContextGenerator

- java.lang.Object
- - opennlp.tools.ml.maxent.BasicContextGenerator

- All Implemented Interfaces:
    ContextGenerator<String>

      public class BasicContextGenerator
      extends Object
      implements ContextGenerator<String>

  Generate contexts for maxent decisions, assuming that the input given to the getContext() method is a String containing contextual predicates separated by spaces. e.g:

  cp_1 cp_2 ... cp_n

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BasicContextGenerator()`
    `BasicContextGenerator(String sep)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String[]` | `getContext(String o)` Builds up the list of contextual predicates given a String.

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

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

- - ### Constructor Detail

    - #### BasicContextGenerator

          public BasicContextGenerator()

    - #### BasicContextGenerator

          public BasicContextGenerator(String sep)

  - ### Method Detail

    - #### getContext

          public String[] getContext(String o)

      Builds up the list of contextual predicates given a String.
      Specified by:
        `getContext` in interface `ContextGenerator<String>`

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