Inflector tweak for singularizing/pluralizing
Reported by Max Aller | May 12th, 2008 @ 10:35 PM | in 0.9.4
When one manually specifies a singular/plural pairing, it seems like it should stick better if/when you try to singularize something that's already singular or pluralize something that's already plural.
Example:
1) "dog".singular # => "dog"
2) "dogs".plural # => "dogs"
3) "forum".singular # => "fora" # oops!
4) "forums".plural # => "forumses" # oops!
5) Language::English::Inflect.word "forum", "forums"
6) "forum".singular # => "fora" # still wrong
7) "forums".plural # => "forumses" # still wrong
I'm proposing that two lines get added to merb-core-0.9.3/lib/
merb-core/vendor/facets/inflect.rb as demonstrated here: http://groups.google.com/group/m...
Comments and changes to this ticket
-
Michael Klishin (antares) May 13th, 2008 @ 01:29 PM
- → Milestone changed from to 0.9.4
- → State changed from new to open
- → Assigned user changed from to Michael Klishin (antares)
Max,
Could you submit a patch with specs since you know what should be done and it is just one line?
I did not follow that thread on merb ML, so I do not understand what and why is going to change.
Thank you.
-
Michael Klishin (antares) May 13th, 2008 @ 04:53 PM
- → State changed from open to resolved
Your suggestion applied but did not eliminate issue with "forum".singular => "forum" case completely.
When I covered inflector with more than 100 spec examples for pluralization and the same number for singularization I found out that
word "forum", "forum"
normal "forums".singular => forum case. Because inflector cannot read your mind and guess you have singular noun, it acts as if it was plural.
If you have any suggestions please submit a patch making sure it does not break any of existing 200+ spec examples for inflector.
-

Max Aller May 13th, 2008 @ 07:39 PM
Well, it's not so much a case of mind-reading, because if I explicitly define a word as being "forum"/"forums", it should know what to do if I say "forum".singular or "forums".plural since the inflector shouldn't be using general singular and plural rules for "-um" words -- it should use the word definition explicitly given to it.
Sorry for the n00bish question, but where is the spec for the inflector and how do I run it? I'd like to submit a patch without breaking anything, of course.
-
Michael Klishin (antares) May 13th, 2008 @ 09:43 PM
It is under spec/private/vendor/facets. To run specs just use rake specs. Thanks and looking forward to see your patch. A note: make it with git-format-patch, please.
If you have questions, IRC channel #merb is probably the best place to get answers quickly.
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
