[ http://jira.andromda.org/browse/UMLMETA-66?page=comments#action_12429 ] Cédric Vidal commented on UMLMETA-66: -------------------------------------
Yeah, it's not as easy as it sounds at first. The litterature on pluralization is pretty hard to find and pluralization algorithms are specific to each language, and most languages sport a lot of exceptions to the general rules. As far as english is concerned, the "Ruby on Rails"'s implementation seems pretty complete, but doesn't deal with composed words, but that might not be a problem because, if your have a class named "GrownUpChild", you just have to pluralize the last word "Child" to give GrownUpChildren" (correct me if I'm wrong), whereas in french for example this is not true, it depends on the type of each word composing the composed word. As far as french is concerned, I have already come up with a pretty good algorithm (made out of a french grammar book) which deals with non composed words and the rule for composed words is not very hard, it just depends on the type of each word, but that's the problem, identifying the type of a word requires some kind of dictionary containing type information. The good news is that there is a very rich source of information on http://www.atilf.fr/. They are developping a complete computerized french linguistics engine which is amongst other things able to compute plurals and singulars (in the bottom left) and to give the type of a word: http://atilf.atilf.fr/dendien/scripts/tlfiv5/showp.exe?5;s=1972013685;p=listes.htm But I don't know if they would be willing to expose the internal database they use. I haven't found any internationalized pluralization algorithm, the concrete solution will be specific to each language, but a common API is possible without any problem. The pluralization engine should also be pluggable (registerable) without subclassing metafacades. I'm thinking about the same mecanism used to register cartridges. You would add your pluralization engine to the classpath which would register itself for a given language (Locale maybe). That's really ambitious but a simpler solution can be implemeted to start with. The bottom line is that however sophisticated the pluralization algorithm is, I think there must be a way for the end user to override the result with a plural mapping file located in his project, a bit like the current java type mapping file so that if the pluralization engine makes a mistake (for any reason) the user can tell what he believes is right and build on its own pluralization file. > Add pluralization support for languages other than english and enhance > english support > -------------------------------------------------------------------------------------- > > Key: UMLMETA-66 > URL: http://jira.andromda.org/browse/UMLMETA-66 > Project: UML Metafacades > Type: Improvement > Versions: 3.1 Final > Reporter: Cédric Vidal > Assignee: Wouter Zoons > > Today, metafacades' names pluralization uses > org.andromda.utils.StringUtilsHelper#pluralize(String) which only deals with > english, and english words are not always well pluralized, for example, knife > is pluralized to knifes instead of knives and child is pluralized to childs > instead of children. > Adding a more complete pluralization support for all languages would be great. ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642