How to turn plural words singular?

前端 未结 13 1805
旧时难觅i
旧时难觅i 2020-12-24 14:06

I\'m preparing some table names for an ORM, and I want to turn plural table names into single entity names. My only problem is finding an algorithm that does it reliably. He

13条回答
  •  再見小時候
    2020-12-24 14:32

    See also this answer, which recommends using Morpha (or studying the algorithm behind it).

    If you know that the words that you want to lemmatize are plural nouns then you can tag them with NNS to get a more accurate output.

    Input example:

    $ cat test.txt 
    Types_NNS
    Pies_NNS
    Trees_NNS
    Buses_NNS
    Radii_NNS
    Communities_NNS
    Sheep_NNS
    Fish_NNS
    

    Output example:

    $ cat test.txt | ./morpha -c
    Type
    Pie
    Tree
    Bus
    Radius
    Community
    Sheep
    Fish
    

提交回复
热议问题