@@ -0,0 +1,855 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A# @Author: largelymfs%0A# @Date:   2014-10-22 21:51:00%0A# @Last Modified by:   largelymfs%0A# @Last Modified time: 2014-10-22 21:58:27%0Afrom nltk.stem.porter  import PorterStemmer%0A%0Aclass Stemmer:%0A%0A    def __init__(self):%0A        self.worker = PorterStemmer()%0A%0A    def stemming(self, word):%0A        return self.worker.stem(word)%0A%0A    def stem_sent(self, words):%0A        return %5Bunicode(self.stemming(word)) for word in words%5D%0A%0A    def stem(self, wordslist, ):%0A        return %5Bself.stem_sent(words) for words in wordslist%5D%0A    %0A%0A%0Aif __name__==%22__main__%22:%0A%09import tokenizer%0A%09s = tokenizer.Tokenizer()%0A%09#w = s.tokenize('I%5C'm studying computers science.')%0A%09with open(%22test%22) as fin:%0A%09%09#text = %5Bl.strip().lower().split() for l in fin%5D%0A%09%09text = fin.read()%0A%09w = s.tokenize(text)%0A%09stemmer = Stemmer()%0A%09print stemmer.stem(w)%0A

Add the stem