1
2
3
4
5
6
7
8
9 from nltk.wordnet import morphy
10
11 from api import *
12
14 """
15 A stemmer that uses Wordnet's built-in morphy function.
16 """
18 """
19 Create a new wordnet stemmer.
20 """
21 pass
22
23 - def stem(self, word):
25
27 return '<WordnetStemmer>'
28
29 if __name__ == '__main__':
30 from nltk import stem
31 stemmer = stem.WordnetStemmer()
32 print 'dogs ->', stemmer.stem('dogs')
33 print 'churches ->', stemmer.stem('churches')
34 print 'aardwolves ->', stemmer.stem('aardwolves')
35 print 'abaci ->', stemmer.stem('abaci')
36 print 'hardrock ->', stemmer.stem('hardrock')
37