PorterStemmer:在Spyder上运行时无阻塞输出也无错误

时间:2018-12-20 08:36:51

标签: python nltk spyder stemming

As evident in my Spyder's screen-shot和下面的代码,我没有得到任何输出,也没有任何错误。我想念什么?:

import nltk
from nltk.stem import PorterStemmer

paragraph = "The Times of India issued its first edition on 3 November 
             1838 as The Bombay Times and Journal of Commerce.[13][14] 
             The paper published Wednesdays and Saturdays under the 
             direction of Raobahadur Narayan Dinanath Velkar, a 
             Maharashtrian Reformist, and contained news from Britain and the world, as well as the Indian Subcontinent. J.E. Brennan was its first editor.[15][16] In 1850, it began to publish 
             daily editions."

sentences = nltk.sent_tokenize(paragraph)
stemmer = PorterStemmer()

for i in range(len(sentences)):
    words = nltk.word_tokenize(sentences[i])
    newwords = [stemmer.stem(word) for word in words]
    sentences[i] = ' '.join(newwords)    

1 个答案:

答案 0 :(得分:1)

感谢@prashant rana,我的臀部是单击帮助而不是变量资源管理器