Esempio n. 1
0
  /**
   * Return the pluralized version of a word.
   *
   * @param word The word
   * @return The pluralized word
   */
  public static String pluralize(String word) {
    if (Inflection.isUncountable(word)) {
      return word;
    }

    for (Inflection inflection : plural) {
      if (inflection.match(word)) {
        return inflection.replace(word);
      }
    }
    return word;
  }
Esempio n. 2
0
  /**
   * Return the singularized version of a word.
   *
   * @param word The word
   * @return The singularized word
   */
  public static String singularize(String word) {
    if (Inflection.isUncountable(word)) {
      return word;
    }

    for (Inflection inflection : singular) {
      // System.out.println(word + " matches " + inflection.pattern + "? (ignore case: " +
      // inflection.ignoreCase + ")");
      if (inflection.match(word)) {
        // System.out.println("match!");
        return inflection.replace(word);
      }
    }
    return word;
  }