Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ['0000', 'Everyone', 'age', 'remembers', 'Þ', 'rst', 'heard', 'contest', 'I', 'sitting', 'hideout', 'watching', ...]
- ['age', 'remember', 'hear', ...]
- syns = wn.synsets("heard")
- print(syns[0].lemmas()[0].name())
- def clean_text(text):
- # Eliminating punctuations
- text = "".join([word for word in text if word not in string.punctuation])
- # tokenizing
- tokens = re.split("W+", text)
- # lemmatizing and removing stopwords
- text = [wn.lemmatize(word) for word in tokens if word not in stopwords]
- # converting token list into synset
- syns = [text.lemmas()[0].name() for text in wn.synsets(text)]
- return text
- syns = [text.lemmas()[0].name() for text in wn.synsets(text)]
- AttributeError: 'WordNetLemmatizer' object has no attribute 'synsets'
Add Comment
Please, Sign In to add comment