/** * <p> * Converts a noun or pronoun to its plural form. * </p> * <p> * This method is equivalent to calling <code>pluralize(word, 2)</code>. * </p> * <p> * The return value is not defined if this method is passed a plural form. * </p> * @param word a singular noun * @return the plural form of the noun */ public String pluralize(String word) { return pluralize(word, 2); }
@Override protected String postProcess(String trimmedWord, String pluralizedWord) { if (trimmedWord.matches("^I$")) { return pluralizedWord; } return super.postProcess(trimmedWord, pluralizedWord); }
String trimmedWord = matcher.group(2); String post = matcher.group(3); String plural = pluralizeInternal(trimmedWord); if (plural == null) { return fallbackPluralizer.pluralize(word, number); return pre + postProcess(trimmedWord, plural) + post;
/** */ @SuppressWarnings("unchecked") private static void fillCustomPluralization() { ArrayList<Object> tmpRule = (ArrayList<Object>) Config.config.getList("customPluralization.rule[@regexmatch]"); List<Rule> customRules = new ArrayList<Rule>(); for (int i = 0; i < tmpRule.size(); i++) { String match = Config.config.getString(String.format("customPluralization.rule(%d)[@regexmatch]", i), "*"); String replace = Config.config.getString(String.format("customPluralization.rule(%d)[@regexreplace]", i), ""); customRules.add(new RegexReplacementRule(match, replace)); } State.getInstance().setCustomPluralizer(new RuleBasedPluralizer(customRules, Locale.ENGLISH, Noun.pluralizer(Locale.ENGLISH))); }
String trimmedWord = matcher.group(2); String post = matcher.group(3); String plural = pluralizeInternal(trimmedWord); if (plural == null) { return fallbackPluralizer.pluralize(word, number); return pre + postProcess(trimmedWord, plural) + post;
@Override protected String postProcess(String trimmedWord, String pluralizedWord) { if (trimmedWord.matches("^I$")) { return pluralizedWord; } return super.postProcess(trimmedWord, pluralizedWord); }
/** * <p> * Converts a noun or pronoun to its plural form. * </p> * <p> * This method is equivalent to calling <code>pluralize(word, 2)</code>. * </p> * <p> * The return value is not defined if this method is passed a plural form. * </p> * @param word a singular noun * @return the plural form of the noun */ public String pluralize(String word) { return pluralize(word, 2); }