Java API for plural forms of English words

前端 未结 7 734
忘掉有多难
忘掉有多难 2020-12-01 10:54

Are there any Java API(s) which will provide plural form of English words (e.g. cacti for cactus)?

相关标签:
7条回答
  • 2020-12-01 11:26

    If you can harness javascript, I created a lightweight (7.19 KB) javascript for this. Or you could port my script over to Java. Very easy to use:

    pluralizer.run('goose') --> 'geese'
    pluralizer.run('deer') --> 'deer'
    pluralizer.run('can') --> 'cans'
    

    https://github.com/rhroyston/pluralizer-js

    BTW: It looks like cacti to cactus is a super special conversion (most ppl are going to say '1 cactus' anyway). Easy to add that if you want to. The source code is easy to read / update.

    0 讨论(0)
提交回复
热议问题