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

opennlp.tools.tokenize.lang

## Class Factory

- java.lang.Object
- - opennlp.tools.tokenize.lang.Factory

-     public class Factory
      extends Object

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `DEFAULT_ALPHANUMERIC`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Factory()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `TokenContextGenerator` | `createTokenContextGenerator(String languageCode, Set<String> abbreviations)`
    `Pattern` | `getAlphanumeric(String languageCode)` Gets the alpha numeric pattern for the language.

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

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

- - ### Field Detail

    - #### DEFAULT_ALPHANUMERIC

          public static final String DEFAULT_ALPHANUMERIC

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### Factory

          public Factory()

  - ### Method Detail

    - #### getAlphanumeric

          public Pattern getAlphanumeric(String languageCode)

      Gets the alpha numeric pattern for the language. Please save the value locally because this call is expensive.
      Parameters:
        `languageCode` - the language code. If null or unknow the default pattern will be returned.
      Returns:
        the alpha numeric pattern for the language or the default pattern.

    - #### createTokenContextGenerator

          public TokenContextGenerator createTokenContextGenerator(String languageCode,
                                                                   Set<String> abbreviations)

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