How to turn plural words singular?

前端 未结 13 1825
旧时难觅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:20

    As an improvement, you could use rules that generate multiple possibilities and then look up the results in a dictionary to weed out impossible options.

    For example replace -ies with -y and -ie. Pies becomes Py and Pie. Only one of those is in the dictionary, so choose that one.

    Perhaps you can even find a dictionary with frequency information and select the most common word you generate.

    If you combine this with an ordered list of rules that covers a few exceptions, you might get pretty good accuracy.

提交回复
热议问题