diff --git a/lib/inflex/pluralize.ex b/lib/inflex/pluralize.ex index 74a9ea6..11d22e4 100644 --- a/lib/inflex/pluralize.ex +++ b/lib/inflex/pluralize.ex @@ -22,7 +22,8 @@ defmodule Inflex.Pluralize do { ~r/^(zombie)s$/i, "\\1" }, { ~r/geese/i, "goose" }, { ~r/criteria/i, "criterion" }, - { ~r/radii/i, "radius" } + { ~r/radii/i, "radius" }, + { ~r/^men/i, "man"} ] @plural_irregular [ @@ -30,7 +31,11 @@ defmodule Inflex.Pluralize do { ~r/^zombies$/i, "zombie" }, { ~r/goose/i, "geese" }, { ~r/criterion/i, "criteria" }, - { ~r/radius/i, "radii" } + { ~r/radius/i, "radii" }, + { ~r/man/i, "men"}, + { ~r/^men/i, "men"}, + { ~r/^women/i, "women"} + ] @singular @irregular ++ [ @@ -60,7 +65,7 @@ defmodule Inflex.Pluralize do @plural @plural_irregular ++ [ { ~r/(child)$/i, "\\1ren" }, - { ~r/(wo|sea)?man$/i, "\\1men" }, + { ~r/(wo)?man$/i, "\\1men" }, { ~r/(m|l)ouse/i, "\\1ice" }, { ~r/(database)s$/i, "\\1" }, { ~r/(quiz)$/i, "\\1zes" }, diff --git a/test/inflex_test.exs b/test/inflex_test.exs index b8a7cda..c397032 100644 --- a/test/inflex_test.exs +++ b/test/inflex_test.exs @@ -20,6 +20,9 @@ defmodule InflexTest do assert "class" == singularize("classes") assert "woman" == singularize("women") assert "seaman" == singularize("seamen") + assert "man" == singularize("men") + assert "abdomen" == singularize("abdomens") + assert "specimen" == singularize("specimens") end test :pluralize do @@ -38,6 +41,10 @@ defmodule InflexTest do assert "classes" == pluralize("class") assert "women" == pluralize("woman") assert "seamen" == pluralize("seaman") + assert "men" == pluralize("men") + assert "women" == pluralize("women") + assert "abdomens" == pluralize("abdomen") + assert "specimens" == pluralize("specimen") end test :skip_singularize do