• NULLPTR (unregistered)

    class Void extends nullptr { static IntPtr target = null; }

  • bvs23bkv33 (unregistered)

    error: expected initializer before 'nullptr'

  • Sole Purpose of VIsit (unregistered)

    I presume that last line is ironic. "Titmice"? It should obviously be "titsmouse." And "snaggleteeth" is definitely not an acceptable plural for "snaggletooth," which is more of an adjectival noun than anything.

    What does this most excellent library do with "octopus?"

    And is there a parallel library for apostrophization?

  • (nodebb)

    What does this most excellent library do with "octopus?"

    Apparently not "octopodes".

  • P. Wolff (unregistered)

    Wouldn't it be easier to use an API to Google translator, translate to Esperanto, add a j, and translate back to English?

    Or save the trouble, and switch to Esperanto right away?

    We humen have strange languages, anyway.

    Test for "-ese": What would be the plural of e. g. "Scorsese"? Or the singular of "geese"?

    Did they test for "-lf" -> "lves", "-ife" -> "-ives" anywhere? "gulves", "dwarves" (ok, this might be correct meanwhile, although JRRT himself asserts it isn't), "fife"

  • P. Wolff (unregistered) in reply to Sole Purpose of VIsit

    "Titmice"? It should obviously be "titsmouse."

    Is this ironic, or do you need help to get your mind out the gutter?

  • Sheriff Fatman (unregistered)

    Words like "pie" and "cow" are not irregular at all, because you just add an "s" to make them "pies" and "cows".

    Maybe an earlier version gave the plural of "cow" as "kine", until someone pointed out that no one actually says that any more, outside of folk-rock lyrics?

  • (nodebb)

    As a meat lover, I'm thoroughly satisfied by the fact that most commonly eaten animals are mentioned: cow, sheep, goose, etc.

  • Shadow (unregistered)

    "completely WTF- and bug-free code that our that our world-class engineers create"

    Keep dreaming. That's just impossible.

  • Code Refactorer (unregistered)

    This code is also from this pluralization service:

    #region Utils ///

    /// captalize the return word if the parameter is capitalized /// if word is "Table", then return "Tables" /// /// <param name="word"></param> /// <param name="action"></param> /// <returns></returns> private string Capitalize(string word, Func<string, string> action) { string result = action(word);

            if (IsCapitalized(word))
            {
                if (result.Length == 0)
                    return result;
    
                StringBuilder sb = new StringBuilder(result.Length);
    
                sb.Append(char.ToUpperInvariant(result[0]));
                sb.Append(result.Substring(1));
                return sb.ToString();
            }
            else
            {
                return result;
            }
        }
    
  • Sole Purpose of VIsit (unregistered) in reply to P. Wolff

    A bit of both, really. I do maintain that the plural of "titmouse" is, in fact, "titmouses." Since it isn't a mouse, but a tit, one could feasibly use the plural of "tit" and add what this WTFery considers a "suffix," producing my puerile alternative. Which leads me to wonder what the supposed plural of "aide-de-camp" or "lieutenant-general" might be.

    Frankly the whole thing is a cretinous idea, as Alex points out. The only sensible way of implementing this is on a lookup basis, rather than a crummy brittle algorithm. I'd use a patricia tree with the singular as the key and the plural as the node value -- and you can avoid bloat by stipulating that any key not found is pluralised with either a "s" or an "es", depending upon a couple of simple and unambiguous rules.

  • Anonymous (unregistered)

    Microsoft seems to have the same problem as Apple: there are only children left for developing software.

    How else can you explain that in the new Microsoft To Do drag-and-drop of images into the app is too hard and isn't possible any more. The app also has a really weird bug: overnight the window gets much broader and the left sidebar gets very narrow. How can you do such lovely stuff?

  • Code Refactorer (unregistered)

    captalize the return word if the parameter is capitalized Which parameter? what is "captalize" ?

    if word is "Table", then return "Tables" I doubt it, where in the code of the method do you append the "s"? The method name itself says nothing about making a plural word from a singular one.

    <param name="action"></param>

    So what specific action should the caller define here? And why does he need to pass an action if he just wants to capitalize the word passed?

    if (IsCapitalized(word)){... do some magic ....}else{return result} So if it is not capitalized, you just return it? And if it already starts with a capital letter, you do some capitalization magic with its first letter?

  • MiserableOldGit (unregistered)

    Not necessarily the programmer's fault this was attempted, leaving aside the crummy WTFs in there.

    I have been asked (read:told) to do several similarly stupid things and, having pointed out the insanity, ended up having to hack at it anyway. Usually after someone else on the team had tried, realised they couldn't do it, and managed to off-load it to me to "troubleshoot and finish off". At least twice it was because the PHB had taken the project on personally to prove the idiot programmers were just being awkward .... I pity the people who inherited those things from me, I may or may not have coded them well, but the basic concept was not fit for a general solution so they will forever generate "bugs" to be investigated.

    I think I'll reserve final judgement on this atrocity until I see what it does with the proper noun Lego, then it may be time for the big red button.

  • (nodebb)

    Everyone knows the plural of cow is kine, and the plural of crowd is crwth.

  • my name is missing (unregistered)

    Everyone knows you just add a z to a word and boomz you have pluralz. My Commentz are alwayz correct.

  • RLB (unregistered) in reply to Steve_The_Cynic

    Apparently not "octopodes".

    I still insist that it should be "hexadecapus".

  • Naomi (unregistered)

    Alex, I hate to say it, but there's a well-known algorithm for English plurals that's about as accurate as a native speaker without special training (ie. its accuracy is comparable to me or Alex but loses to a professional editor or translator). Admittedly, it does rely on a whole glob of lookup tables and regex, but that's about what you'd expect.

    There's still plenty of WTF in this code (and they're also reinventing the wheel, see above) and I have to agree that seeing this in the field is a nice piece of sangfroid :)

  • (nodebb)
    private string[] _uninflectiveWordList = new string[] { 
        "jackanapes", "species", "corps", "mackerel", "swine",
    

    The swines!

  • Scott (unregistered)

    How does it handle phrases like "Attorney General" or "mother in law"?

  • Brian (unregistered)

    I used LINQPad a lot in a previous job, which also tried to auto-pluralize (and capitalize) table names with some apparently simple rules, often leading to some very amusing Gollum-ish nameses for the tableses.

    As a side note - perhaps the tools that work with the DB ought to simply respect the existing names and not try to make any "helpful" transformations? Especially tools that are intended to help you write code against those tables... kind of annoying to copy your LINQPad code into your VS editor and then have to go through and change all the names back to what they should be.

  • Kevin S (unregistered)

    I'm just glad to see that pneumonoultramicroscopicsilicovolcanoconiosis made the list.

  • TruePony (unregistered)

    When we switched to entity framework my team ran a Microsoft tool to generate a stub class for every table we had, so the tool had to figure out singular forms of our table names. We got a nice chuckle when our "FooChanges" table had a "FooChanx" class generated for it...

  • Singluar Name (unregistered)

    private List<string> _knownSingluarWords;

  • Merus (unregistered)

    I know Rails does automated pluralisation and capitalisation, but it also has the good sense to have a place in the settings where you can put in your own plurals.

  • Stu (unregistered)

    Wow. It doesn't even get the hard-coded examples right, the plural of "cloth" is not "clothes", it's "cloths". It also has no hope of handling homonyms correctly ("die" -> "dice/dies", "medium" -> "media/mediums", etc.).

  • Angela Anuszewski (google) in reply to Sheriff Fatman

    and I am guessing "brothers" used to say "brethren" too.

  • ooOOooGa (unregistered)

    I'm also suspecting non-native English coder here:

    money => moneys gas => gases

    Not 'money' and, 'gasses'?

  • (nodebb) in reply to MiserableOldGit

    I think I'll reserve final judgement on this atrocity until I see what it does with the proper noun Lego, then it may be time for the big red button.

    According to the company itself, the plural should be "Lego bricks", but quite frankly that's a long-lost cause.

  • MiserableOldGit (unregistered) in reply to ooOOooGa

    Well you can say monies under certain circumstances but like with gasses, the rule on when to pluralise is a bit different.

  • MiserableOldGit (unregistered) in reply to Steve_The_Cynic

    Depends where you live. In the countries which invented the language and the construction toy you'll be chased to the hills for that crime. My finger is hovering, I need your coordinates ...

    Although it does highlight that the pluralisation service needs to be region sensitive, best raise a work order for that.

  • (nodebb)

    This was signaled by Cabbage on the forums: https://what.thedailywtf.com/topic/25428/microsoft-s-cl-ic-mistake?_=1580227766908

  • Foo AKA Fooo (unregistered)

    s/louse$/lice/;s/mouse$/mice/;s/tooth$/teeth/;s/goose$/geese/;s/foot$/feet/

    Yeah, tell me again how regexes (regexen? ;) are so cumbersome. Used right, they're compact, readable and probably much faster than that code. (Sure, I could also say s/([lm])ouse$/\1ice/ to keep close to that code, but why bother?)

    I don't know what else this great library does that isn't shown here, but I guess it would make for a really nice and simple (though not necessarily short) sed script.

  • MightyBigCar (unregistered) in reply to Sheriff Fatman

    Some of the keys in the _irregularPluralsDictionary actually do have acceptable irregular plurals. For example: cow -> cattle, brother -> brethern.

    Some of the others that end in 's' have irregular but seldom used (at least, not anymore) plurals that have been replaced by more standard pluralization in modern usage. For example: bus -> busses, gas -> gasses.

    Similarly for some words ending in vowels, which usually take 's' but can take 'es' in the plural. For example, casino -> casinoes. Casinos, if I recall, can also be casini, but that might just be borrowing from Italian and never was a common English plural. Anyway, the rule "'es' after a vowel, except silent 'e'"* was beaten into my head in the 4th grade by a teacher who in turn was born around the turn of that century, and was likely educated using texts from the middle of the century before that one (entirely likely, given how parsimonious the school board in that state was about acquiring new textbooks - more than once I was assigned one with a first 'Assigned to student' entry from 20 years or more before I was born). Decades later, I'm still trying to shake that rule and similar ones.

    • the logic behind this was that a consonant after a vowel turns it into a short vowel, but an 'e' makes it a long vowel. So to preserve the long 'o' in casino, it had to pluralize as casinoes. Conversely, you didn't want to turn a silent 'e' into a long 'e', so case -> cases.
  • Alex (unregistered)

    The first thing I do when using Entity Framework is disable this stupid misfeature, because I speak Spanish, and I work at a local company in a country that speaks Spanish, so all the table names are in Spanish, so I don't want any English pluralization dammit! Thanks god EF Core ditched this feature.

  • Sole Purpose of VIsit (unregistered) in reply to Foo AKA Fooo

    So ... you're proposing to take an impracticable design decision, badly implemented by a cretin in a portable, compiled, language, and turn it into an impracticable design decision, badly implemented by yourself in a non-portable, non-compiled language that uses an archaic form of regexps (backslash num for substition)?

    As improvements go, this doesn't. At a minimum I'd want it in Python or Perl (portable, can be compiled, have modern standard regexp syntax), and even then it would suffer from every last one of the issues that Alex brought up, with the additional fun feature that it doesn't even work as a .NET library. Remember the .NET library thing? It was kinda a requirement.

  • skington (unregistered)

    There's already a Perl library that does this: https://metacpan.org/pod/Lingua::EN::Inflexion

  • Argle (unregistered)

    For those curious about this subject, I highly recommend "The Language Instinct" by Steven Pinker. There's some good info on how we add things like plurals to words.

    Also, this brings to mind my first contract programming job. Back when Windows 2 was a thing. A small company was scanning docs and making CD-ROMs. Very new at the time. Modern spell-checkers were still some years off and scan-to-text was really still in its infancy. The glitches, however, were predictable. They had a program which would read scanned documents and swap common errors. For example "Califomia" -> "California" or "car5"->"cars". How simple is that, right? However, their programmer wrote it in 8086 assembler (???!!! WTF?, right?) and embedded all the word pairs inside. I was young and naive enough to not have realized that there were catastrophically bad professional programmers out there. I asked why. I was told he did it for performance. I said no way in heck I was going to tweak assembler. I'll re-write it in C. Might not run as fast, but it will get the job done. Normally, the asm version took about 30 minutes a Mb. I ran mine against a Mb file and it was done in less than a minute. I actually shocked myself. My clients asked me how this was possible. Since I actively refused to look at the code, I was never really sure. But it was my first intro to "WTF?"

  • Álvaro González (github)

    My company adopted some MVC framework based on "configuration by convention". During basic training we were instructed to handle irregular pluralisation by creating a custom rule in the builtin inflector, which surely lead to very productive development hours since the codebase was not even in English. I eventually realised that singular-to-plural transformations were only used in one place: the code to find a database table given a model name. And you could just set the table name in model properties.

  • James (unregistered) in reply to RLB

    Wouldn't it be "nonapus"?

  • rosuav (unregistered) in reply to Scott

    The plural of Attorney General is Attorneys General. The, uhh, past tense of Attorney General is Attorneyed General?

  • David C. (unregistered)

    The old Nethack game has its own make-plural function. It's primarily aimed at objects found in the game, but is also (somewhat) generalized in order to deal with words provided by the player (e.g. your favorite fruit).

    https://nethackwiki.com/wiki/Source:NetHack_3.6.1/src/objnam.c#makeplural

  • Officer Johnny Holzkopf (unregistered)

    Discussion of propers pluralsensera: https://www.youtube.com/watch?v=QWzYaZDK6Is

  • Just Me (unregistered)

    Plurals In English are hard!

    In general, we look at the original language and follow the same rule in English (medium => media, panino => panini). In this list, remember the oddity which is octopus (octo is Latin for 8 and pus is Greek for foot). Octopoda would be correct when describe different types of octopus

    Fish can be singular or plural, but fishes indicates multiple species of fish. Person can be pluralized as persons or people. If "people" is singular, its plural is "peoples". The plural of mouse when referring to the computer apparatus is "mouses", but "mice" is correct for animals.

    After looking at the usual irregular plurals, codifying -s or -es can be hard because its based on the word's terminal sound instead of simply looking at the last few letters.

  • MiserableOldGit (unregistered)
    The plural of mouse when referring to the computer apparatus is "mouses", but "mice" is correct for animals.

    Why and who says so? I'd always say mice and I never heard "mouses" anywhere in my travels.

    Try plurals in Dutch, it's an irregular mishmash of the English approach, randomly mixed between British and American, together with a lot of French and German pluralisation logic. Well, there is no logic, it is case by case.

  • PotatoEngineer (unregistered)

    I once wrote a depluralizer, which has even more weirdness than a pluralizer. Mind you, this was a Greasemonkey script for an online game, so the stakes were rather lower, and I did a lot of hard-coding for the irregular plurals (loaves -> loaf, knives -> knife, etc.). But that was okay, because the game wasn't huge.

    I stuffed the results into a DB (I was tracking monster drops), so a bad script would lead to bad data, but the DB was small enough that I could still manually fix the DB when I hit another depluralization error.

  • (nodebb)

    I strongly suspect that the coder learned English at the university because of their textbook approach to it, not to mention not knowing a bunch of the plurals.

    However, I don't think the basic approach is bad--it appears to be apply rules to the common cases and a lookup table to the rest. That's a lot smaller than a lookup table for every English word.

  • steve76 (unregistered) in reply to Loren Pechtel

    I would go with a nightmare storm of really tight acceptance criteria, with the tortured cynical sunlight of a soul piercing through: !!!jakenapes!!!

    "We view ourselves as the Olympic athletes of computer programming."

    • Valley of the Boom

    ... ... ...

    Tonya Harding was an Olympic athlete. And Mike Tyson. Ryan Lochte. Barkley.

    And that's not even touching upon House Kardashian.

  • Elifah (unregistered)

    Wouldn't the modern approach be to train a neural network?

  • Tim (unregistered)

    Since when has "clothes" been the plural of "cloth"? That's not an irregular plural, it's a different word!

Leave a comment on “Microsoft's English Pluralization Service”

Log In or post as a guest

Replying to comment #:

« Return to Article