APISonar


zemberek.tokenization.Token.Type.Time

> zemberek > tokenization > Token > Type > Time
zemberek APIs tokenization APIs Token APIs Type APIs Time APIs

Example 1
public static String normalizeForNer(String input) {
    input = input.toLowerCase(Turkish.LOCALE);
    List<String> result = new ArrayList<>();
    for (Token t : TurkishTokenizer.DEFAULT.tokenize(input)) {
      String s = t.getText();
      if (t.getType() == Token.Type.Date || t.getType() == Type.Number
          || t.getType() == Token.Type.Time) {
        s = "*" + s.replaceAll("[0-9]", "D") + "*";
      }
      result.add(s);
    }
    return String.join("", result);
  }
Example 2
static boolean tokenTypeAccpetable(Token t) {
    return !(t.getType() == Token.Type.Punctuation ||
        t.getType() == Token.Type.Number ||
        t.getType() == Token.Type.RomanNumeral ||
        t.getType() == Token.Type.PercentNumeral ||
        t.getType() == Token.Type.Time ||
        t.getType() == Token.Type.Date ||
        t.getType() == Token.Type.Emoticon ||
        t.getType() == Token.Type.URL ||
        t.getType() == Token.Type.Email ||
        t.getType() == Token.Type.HashTag ||
        t.getType() == Token.Type.Unknown);
  }