- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Admin
The Nethack pluralization code is an impressive mess as well...
http://celabs.com/nethack/html/objnam_8c_source.html
See line 1268
Admin
Admin
sry
he is jackwagan who has stoled my acount.
Admin
Admin
Admin
Is anyone else pissed off that Alex endorsed SOPA yesterday?
Admin
Let's talk about sees baby, let's talk about all the good things that make me. Let's talk about sees.
Admin
Admin
Uh...how is this a WTF?
Please submit code that does the same thing better.
Admin
Sheesh! Am I the only one who looked at the logo on the RHS of the grinning guy with the thumb up and thought: "That is one heck of a pointy biceps ..."
Admin
Admin
I'm {Chrises|Chris's|Chris'} manager, and I recognized this code as soon as I saw it. I also will proudly claim ownership of the function, though it was a collaborative effort.
Its used in lots of places in our code-base, not just the one spot where Chris saw it, and the special cases are purely tongue in cheek, I can assure you. The word "sheep" will have never passed through this function in a production environment.
Admin
This isn't so bad. Incomplete, should have been more extensible, should have used a library or based its self on an existing database of rules and exceptions. Pluralisation is a pain in the butt and a fools errend for most programmers to DIY. Most implementations will be WTF by default.
Admin
This function was only intended to "pluralize" a word, the is / are logic was handled in the calling validation code.
PB - The code works fine, the problem is there are a ridiculous number of special cases it doesn't handle, which means the resulting error message will have incorrect spelling, and that is WTF.
Also, can't believe my first ever post to TDWTF was front-paged :-)
Admin
Does thedailywtf and facebook share code?
Admin
Rails handles this, as well as a number of other transformations. The main use is so it can automagically connect a model class "User" with a database table "users".
At a certain point, they stopped accepting patches to the inflection module, probably because this is not an easy problem. Instead, they provided an API for the application to add its own inflections, or (of course) to specify the table in question.
(Incidentally, this is the idea of "covention over configuration" -- when it's done right, the configuration is still there if you need it, you can just get stuff done faster when your problem happens to fit the conventions.)
Admin
That second one should be interesting, seeing as how words like life and live have the same plural :D
Admin
/selfcorrect: live doesn't have a plural ofcourse, but lives can be both a plural of life, or a verb :D
Admin
This post is fucking bullshit. Are you fucking kidding me? Give me some quicker code to fucking translate singular into plural in the English fucking language? Fucking iditios thinking such a thing is fucking simplistic. God damn the stupid retard that posted this. What the fuck is your stupid problem? Thanks for the fucking goddamn Google results on my product.
Admin
Wouldn't the simplest solution just be to invoke a function whenever you had to spit out a count and a word?
Such as....:
Function SingularOrPlural(count, singular, plural) If count < 0 Then throw #FileNotFpundException End If If count = 1 Then SingularOrPlural = count & " " & singular Else SingularOrPlural = count & " " & plural End If End Function
fullsentence = "There's " & SingularOrPlural(n, "bottle", "bottles") & " on the wall."
Admin
What? Now you tell me ...
Admin
nice try, Stan.
Admin
More or less. 218 lines of well commented code, and Also handles some Japanese words and funny words like djinni. I'm surprised it is so short.
See http://nethackwiki.com/wiki/Objnam.c#makeplural
Admin
Admin
Admin
Admin
Admin
Seems like a decent idea to me.
I just wonder if this creative person has come up with something to handle tenses. You know: was/is/will be; hasn't/isn't/won't; ran/running/will run; and etc.
I mean, just think about it: If it will handle future pluperfect, we'll really have something.
Admin
Since the sentence was: "at least 3 options are required"
Why not just code a sentence like this & avoid plurals altogether:
"Options required: X" "Options required: at least X"
Where X, in the case sited, is 3. If I'm right, X could be replaced by any number.
The amazingly stupid thing about plurals is that they never add any meaning; they're not strictly necessary to communicate the base information - which is why many languages get on fine without them.
Admin
You mean they are able to read what's on the screen today?
Admin
You mean they are able to read what's on the screen today?
(Sorry for the previous WTF)
Admin
This is why my company tasked a team with developing a Lojban compiler. We already speak the language at the office. I'm looking forward to coding in it. It's going to be so natural and productive!
Admin
This. This way we could be more productibe and insult our users at the same time.
Admin
I am impressed that the original coder resisted the (obvious) urge to create a domain-specific language for stemming-rules (I wouldn't...)
Admin
Makes sense to me : do it fast, well and for free. thx
Admin
"I'm Mc don't know how to pluralize word" --> check out Jon Lajoie ;)
Admin
fouse =>
Admin
And of course "Sheep are fluffy" -> "sheep are fluffy" The case switching in the special cases is bad.
Admin
In Dutch, the plural is much simpler: you just put 'en' behind the word.
Well, except if the word ends in a 'schwa', in which case you put 's' behind the word.
And with certain words, you have to double the consonant at the end, but not with all: vat ('vat') -> vaten; kat ('cat') -> katten.
And you have to remember to remove the extraneous vowel if the pronunciation remains the same: sloot (one of the many Dutch words for 'canal') -> sloten. Which happens to be also the plural for 'slot' ('lock').
And for certain words, you have to put 'eren' behind: ei ('egg') -> eieren.
And for certain words ending in 'man', the plural becomes 'lieden': timmerman (carpenter) -> timmerlieden. Usually, at least.
And then there are the classic Greek and Latin words, which retain their original plurals: museum -> musea. Well, most of them, anyway.
But other than that, it's really simple.
Admin
'persons'. Didn't you see the code?
Admin
here is a link to more complex Java code :)
http://www.java2s.com/Tutorial/Java/0040__Data-Type/Transformswordstosingularpluralhumanizedhumanreadableunderscorecamelcaseorordinalform.htm
Admin
And don't forget Bedrijf -> Bedrijven BUT Smurf -> Smurfen
Admin
Broer -> Gebroeders Ei - Eieren Portier -> portieren Portier -> portiers
Admin
Actually, that might work.
For ages we've argued about whether people should have to get a license to use computers. How about we require them to learn a foreign language...?
Admin
Well, there were some people who used to use "mouses" for computer mice, with the distinction being animate/inanimate object pluralization. It was quite big in certain circles before every computer came with one.
Admin
Actually general pluralization for a language is a very complicated thing. You first need a dynamic expression or hard coded expression for every language that specifies how many plural rules are available for the language and then you need to translate the sentence as a whole as many times as there are plural rules, for example Irish Gaelic has 5 plural rules so you would need 5 translated sentences. As an example Mozilla has created a complete pluralization framework for Firefox, check out Localization and Plurals for the plural rules.
Admin
" sloot (one of the many Dutch words for 'canal')"
Chuckle! Like the 50 words for snow of the Eskimos?
Admin
Admin
http://en.wikipedia.org/wiki/Eskimo_words_for_snow
The Sami, on the other hand, do have hundreds of words for snow.
Anyway, a canal is an artificial waterway. Because the Dutch are quite adapt at digging them, they have quite a few words for them, mostly based on the size. The smallest type is 'beek', which can also be used for a natural waterway and would, in that case, translate to brook. A bit bigger is 'sloot', even bigger would be 'kanaal' (big enough to go through with a boat or ship). Somewhere in there, there's also 'greppel', 'geul', 'vliet', 'gracht' (in or around a city, like Amsterdam), 'vaart' and a couple more less often used words.
That's just artificial waterways. Obviously, there are plenty of other words having to do with water and the sea, such as 'kwelder', which is a piece of land outside the dikes that only submerges during very high tide.
About half of the country would be submerged if it weren't for dunes and dikes (both against the sea and against rivers). Big pumps get rid of the water on a 24/7 basis. This used to be done by the famous windmills; these days, they mostly run on electricity.
There's one, built in the 19th century, that runs on steam and is a Unesco World Heritage site. The last time it was used for real (because of all the excess water) was about two weeks ago.
One can imagine that global warming and rising sea levels are a bit of an issue for the Netherlands.