Be careful with that code, I don't think it will provide coverage for
all English words. It's originally based on a Ruby function, I
believe this one:
http://www.google.com/codesearch?hl...=facets-1.1.0/lib/facet/string/singular.rb#a0
(
http://tinyurl.com/2xs8o4 )
However when I converted the above Ruby code it to C# and ran it
through a test of random words, it failed a large percentage of the
time. It looks like the Google set has a few extra regular
expressions, but not enough to be considered comprehensive.
Unfortunately I don't have an alternative suggestion to offer, just
the above warning. If it helps, the test data I used is below (for
converting plural -> singular).
Best regards,
Sam
------------------------------------------------------------
We're hiring! B-Line Medical is seeking .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.
Dictionary<string, string> tests = new Dictionary<string,
string>(128);
tests["Americans"] = "American";
tests["analyses"] = "analysis";
tests["bays"] = "bay";
tests["bureaus"] = "bureau";
tests["businesses"] = "business";
tests["buses"] = "bus";
tests["cacti"] = "cactus";
tests["cactuses"] = "cactus";
tests["calves"] = "calf";
tests["carpets"] = "carpet";
tests["chiefs"] = "chief";
tests["choruses"] = "chorus";
tests["churches"] = "church";
tests["companies"] = "company";
tests["courses"] = "course";
tests["cows"] = "cow";
tests["crashes"] = "crash";
tests["criteria"] = "criterion";
tests["discos"] = "disco";
tests["doors"] = "door";
tests["factories"] = "factory";
tests["farms"] = "farm";
tests["farmers"] = "farmer";
tests["faxes"] = "fax";
tests["firemen"] = "fireman";
tests["fish"] = "fish";
tests["flowers"] = "flower";
tests["forks"] = "fork";
tests["foxes"] = "fox";
tests["friends"] = "friend";
tests["garages"] = "garage";
tests["gardens"] = "garden";
tests["geese"] = "goose";
tests["grown-ups"] = "grown-up";
tests["heroes"] = "hero";
tests["highways"] = "highway";
tests["horses"] = "horse";
tests["hovercraft"] = "hovercraft";
tests["indexes"] = "index";
tests["indices"] = "index";
tests["kisses"] = "kiss";
tests["lives"] = "life";
tests["lights"] = "light";
tests["loaves"] = "loaf";
tests["memos"] = "memo";
tests["mountains"] = "mountain";
tests["mice"] = "mouse";
tests["ovens"] = "oven";
tests["parties"] = "party";
tests["pens"] = "pen";
tests["pennies"] = "penny";
tests["potatoes"] = "potato";
tests["prizes"] = "prize";
tests["proofs"] = "proof";
tests["scarves"] = "scarf";
tests["series"] = "series";
tests["staples"] = "staple";
tests["statuses"] = "status";
tests["stores"] = "store";
tests["Swiss"] = "Swiss";
tests["tables"] = "table";
tests["take-offs"] = "take-off";
tests["teachers"] = "teacher";
tests["theses"] = "thesis";
tests["thieves"] = "thief";
tests["tomatoes"] = "tomato";
tests["torpedoes"] = "torpedo";
tests["videos"] = "video";
tests["watches"] = "watch";