What is the best stemming method in Python?

后端 未结 6 1580
被撕碎了的回忆
被撕碎了的回忆 2020-12-12 22:36

I tried all the nltk methods for stemming but it gives me weird results with some words.

Examples

It often cut end of words when it shouldn\'t do it :

6条回答
  •  鱼传尺愫
    2020-12-12 22:49

    In my chatbot project I have used PorterStemmer However LancasterStemmer also serves the purpose. Ultimate objective is to stem the word to its root so that we can search and compare with the search words inputs.

    For Example: from nltk.stem import PorterStemmer ps = PorterStemmer()

    def SrchpattrnStmmed(self):
        KeyWords =[]
        SrchpattrnTkn = word_tokenize(self.input)
        for token in SrchpattrnTkn:
            if token not in stop_words:
                KeyWords.append(ps.stem(token))
                continue
        #print(KeyWords)
        return KeyWords
    

    Hope this will help..

提交回复
热议问题