I am working on a script to extract relevant tags from the text file which i converted from a URL. One part of the script is giving me error when i apply stemmer, the code is as below
def __call__(self, tag):
'''
@param tag: the tag to be stemmed
@returns: the stemmed tag
'''
string = self.preprocess(tag.string)
tag.stem = self.stemmer.stem(string)
return tag
the error is as below
Type Error - stem() missing 1 required positional argument : 'word'
the line causing the error is
tag.stem = self.stemmer.stem(string)
I am using Python, if anyone can help me to modify the code to get rid of the error please.
I think you didn't instantiate self.stemmer
,ie
class stemmer(object):
def stem(self, word):
print('stem')
obj = stemmer
obj.stem("word")
this will cause same error,beacause Class
won't pass self
argument to method,so you need instantiate the stemmer
obj = stemmer()
obj.stem("word")