I have a list of strings:
['bill', 'simpsons', 'cosbys', 'cosby','bills','mango', 'mangoes']
What is the best to remove all the plurals from this list? So, I want the output to be:
['bill', 'simpsons', 'cosby','mango']
In general, the process is called `stemming', and there is a package called 'stemming' for python.
Used like so:
from stemming.porter2 import stem
stem("simpsons")
Stemming does more than just stem plurals, but you could modify the stemming package to only perform the plural stemming. Take a look at the source: http://tartarus.org/martin/PorterStemmer/python.txt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With