@Test public void testSingularize() { assertThat(Inflector.getInstance().singularize("dwarves"), is("dwarf")); assertThat(Inflector.getInstance().singularize("curves"), is("curve")); assertThat(Inflector.getInstance().singularize("halves"), is("half")); assertThat(Inflector.getInstance().singularize("vertices"), is("vertex")); assertThat(Inflector.getInstance().singularize("proofs"), is("proof")); assertThat(Inflector.getInstance().singularize("moths"), is("moth")); assertThat(Inflector.getInstance().singularize("houses"), is("house")); assertThat(Inflector.getInstance().singularize("rooves"), is("roof")); assertThat(Inflector.getInstance().singularize("elves"), is("elf")); assertThat(Inflector.getInstance().singularize("baths"), is("bath")); assertThat(Inflector.getInstance().singularize("leaves"), is("leaf")); assertThat(Inflector.getInstance().singularize("calves"), is("calf")); assertThat(Inflector.getInstance().singularize("lives"), is("life")); assertThat(Inflector.getInstance().singularize("knives"), is("knife")); assertThat(Inflector.getInstance().singularize("addresses"), is("address")); assertThat(Inflector.getInstance().singularize("mattresses"), is("mattress")); assertThat(Inflector.getInstance().singularize("databases"), is("database")); assertThat(Inflector.getInstance().singularize("bison"), is("bison")); assertThat(Inflector.getInstance().singularize("buffalo"), is("buffalo")); assertThat(Inflector.getInstance().singularize("deer"), is("deer")); assertThat(Inflector.getInstance().singularize("fish"), is("fish")); assertThat(Inflector.getInstance().singularize("sheep"), is("sheep")); assertThat(Inflector.getInstance().singularize("squid"), is("squid")); assertThat(Inflector.getInstance().singularize("mattress"), is("mattress")); assertThat(Inflector.getInstance().singularize("address"), is("address")); assertThat(Inflector.getInstance().singularize("men"), is("man")); assertThat(Inflector.getInstance().singularize("women"), is("woman")); assertThat(Inflector.getInstance().singularize("specimen"), is("specimen")); assertThat(Inflector.getInstance().singularize("children"), is("child")); assertThat(Inflector.getInstance().singularize("s"), is("s")); assertThat(Inflector.getInstance().singularize("status"), is("status")); assertThat(Inflector.getInstance().singularize("statuses"), is("status")); assertThat(Inflector.getInstance().singularize("LineItemTaxes"), is("LineItemTax")); assertThat(Inflector.getInstance().singularize("WidgetList"), is("Widget")); assertThat(Inflector.getInstance().singularize("slaves"), is("slave")); }
public String singularize(String word) { if (uncountables.contains(word.toLowerCase())) { return word; } return replaceWithFirstRule(word, singulars); }
Inflector { public String singularize(String word) { if (uncountables.contains(word.toLowerCase())) { return word; } return replaceWithFirstRule(word, singulars); } }
Inflector { public String singularize(String word) { if (uncountables.contains(word.toLowerCase())) { return word; } return replaceWithFirstRule(word, singulars); } private  Inflector(Builder builder); }
Inflector { public String singularize(String word) { if (uncountables.contains(word.toLowerCase())) { return word; } return replaceWithFirstRule(word, singulars); } private  Inflector(Builder builder); static Inflector.Builder createDefaultBuilder(); static Inflector getInstance(); String pluralize(String word); String singularize(String word); static Builder builder(); }
Inflector { public String singularize(String word) { if (uncountables.contains(word.toLowerCase())) { return word; } return replaceWithFirstRule(word, singulars); } private  Inflector(Builder builder); static Inflector.Builder createDefaultBuilder(); static Inflector getInstance(); String pluralize(String word); String singularize(String word); static Builder builder();  }