opennlp.tools.util.featuregen

## Class StringPattern

- java.lang.Object
- - opennlp.tools.util.featuregen.StringPattern

-     public class StringPattern
      extends Object

  Recognizes predefined patterns in strings.

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `containsComma()`
    `boolean` | `containsDigit()`
    `boolean` | `containsHyphen()`
    `boolean` | `containsLetters()`
    `boolean` | `containsPeriod()`
    `boolean` | `containsSlash()`
    `int` | `digits()` Retrieves the number of digits.
    `boolean` | `isAllCapitalLetter()`
    `boolean` | `isAllDigit()`
    `boolean` | `isAllHiragana()`
    `boolean` | `isAllKatakana()`
    `boolean` | `isAllLetter()`
    `boolean` | `isAllLowerCaseLetter()`
    `boolean` | `isInitialCapitalLetter()`
    `static StringPattern` | `recognize(String token)`

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

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

- - ### Method Detail

    - #### recognize

          public static StringPattern recognize(String token)

    - #### isAllLetter

          public boolean isAllLetter()

      Returns:
        true if all characters are letters.

    - #### isInitialCapitalLetter

          public boolean isInitialCapitalLetter()

      Returns:
        true if first letter is capital.

    - #### isAllCapitalLetter

          public boolean isAllCapitalLetter()

      Returns:
        true if all letters are capital.

    - #### isAllLowerCaseLetter

          public boolean isAllLowerCaseLetter()

      Returns:
        true if all letters are lower case.

    - #### isAllDigit

          public boolean isAllDigit()

      Returns:
        true if all chars are digits.

    - #### isAllHiragana

          public boolean isAllHiragana()

      Returns:
        true if all chars are hiragana.

    - #### isAllKatakana

          public boolean isAllKatakana()

      Returns:
        true if all chars are katakana.

    - #### digits

          public int digits()

      Retrieves the number of digits.

    - #### containsPeriod

          public boolean containsPeriod()

    - #### containsComma

          public boolean containsComma()

    - #### containsSlash

          public boolean containsSlash()

    - #### containsDigit

          public boolean containsDigit()

    - #### containsHyphen

          public boolean containsHyphen()

    - #### containsLetters

          public boolean containsLetters()

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