Plural of word

Hello Friends,

I just want to know how to find plural of a word in C#

I have one textbox where user will enter his word i.e Text.

Then how to find the plural of that word.



Answer this question

Plural of word

  • tech2hardikjoshi

    The way I will approach this problem is to just create a file of exemption to the rule.

    <singular>,<plural>,<remark>
    datum, data, plural available
    radius, radii, plural available
    politics, politics, no plural

    If word is not part of the list you apply the 's' or 'es' rule.

    Load the file using the first column as index during startup or first use of the feature. This way you don't have to modify your code each time you add a new entry.

  • Redfox72

    Regardless, you will need a dictionary for this. The "remark" should let you add extra info.

    <singular>,<plural>,<remark>
    datum, data, plural available
    radius, radii, plural available
    politics, politics, no plural
    fish, fish;fishes, context dependent

  • =Steve D=

    Native English speakers have no problem pluralizing words. Just because the rules are complex doesn’t mean the rules don’t exist to cover every situation.

    What is difficult is translating those rules into algorithms, as your reference indicates.



  • bb32223

    Peter N Roth wrote:

    Still, there’s the problem of context. “He fishes.” vs “They fish.”

    Not easy.

    Or, "They fish for fishes while he fishes for fish".

    You could probably come up with an algorithm to handle the basic pluralization rules and handle the exceptions with a dictionary (like foot/feet); but, the context-sensitive pluralization would require a really complex grammar parser.

    As I say, not as simple as just a few rules.



  • Jignesh Desai

    You need to find the rules of pluralization for the language of interest and write them into your code.

     

    For example, in English, you need to at least implement the rules to make these words plural:

    Punt

    Radius

    Thief

    Mass (the word without the 'M' becomes three assterisks in this forum)

    Chevy

    Datum

     

    This looks like a homework problem, naked running notwithstanding, eh



  • phenshaw

    You would have to have a dictionary of words you supported and a pural version of the word.

    There are no rules in the English Language for puralizing that works for all words.



  • yi peng

    >> you need to at least implement the rules to make these words plural: <<

    Depends.... Does the solution need to be all- (or even mostly-) encompassing or just good-enough to cover one particular domain I recently had the reverse problem --given a plural (table name), come up with the singular (record name),-- but since I knew that there would only be about 300 words this would need to be applied to, a few simple rules were enough. The tricky words in the group: Categories, Media, and Bases (for Basis).

    As for your sample group, it's remarkably heavy on edge-cases (two Latin words and a proper noun/nickname). (And I'm betting you'd say that "Radiuses" is wrong for the plural of "Radius", although, dictionaries would disagree)



  • gcannata

    In terms of pluralization, it's more like a couple of rules with a series of unsystematic exceptions. I think it would be much easier to simply have a lookup, or dictionary.

  • Ronan Jordan

    There are rules that work for most of the language; but, with most things in English there are exceptions...

  • Suhayb

    Of course(!) there are rules that work for all words, else the language would fall apart.



  • Hacman

    Still, there’s the problem of context. “He fishes.” vs “They fish.”

    Not easy.



  • Jarvism

    It would depend on context; which is not a simple rule.

    If I caught two salmon, I would have two fish.  If I caught a salmon and a tuna, I would have two fishes.

    Some other exceptional cases:

    Foot: feet
    Box: Boxes

    Have a look at some of the papers on the subject:

    http://www.csse.monash.edu.au/~damian/papers/HTML/Plurals.html



  • snowbound

    Excellent points, but you'd lose your bet.

  • Plural of word