Class NGram

java.lang.Object
com.optimaize.langdetect.cybozu.util.NGram

public class NGram extends Object
TODO document. Users don't use this class directly. TODO this class treats a word as "upper case" if the first 2 characters are upper case. That seems like a simplification, would need documentation.
Author:
Nakatani Shuyo
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    ngrams are created from 1gram to this amount, currently 2grams and 3grams.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addChar(char ch)
     
    @Nullable String
    get(int n)
    TODO this method has some weird, undocumented behavior to ignore ngrams with upper case.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • N_GRAM

      public static final int N_GRAM
      ngrams are created from 1gram to this amount, currently 2grams and 3grams.
      See Also:
  • Constructor Details

    • NGram

      public NGram()
  • Method Details

    • addChar

      public void addChar(char ch)
    • get

      @Nullable public @Nullable String get(int n)
      TODO this method has some weird, undocumented behavior to ignore ngrams with upper case. Get n-Gram
      Parameters:
      n - length of n-gram
      Returns:
      n-Gram String (null if it is invalid)