Guest User

Untitled

a guest
Nov 21st, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. ['0000', 'Everyone', 'age', 'remembers', 'Þ', 'rst', 'heard', 'contest', 'I', 'sitting', 'hideout', 'watching', ...]
  2.  
  3. ['age', 'remember', 'hear', ...]
  4.  
  5. syns = wn.synsets("heard")
  6. print(syns[0].lemmas()[0].name())
  7.  
  8. def clean_text(text):
  9. # Eliminating punctuations
  10. text = "".join([word for word in text if word not in string.punctuation])
  11. # tokenizing
  12. tokens = re.split("W+", text)
  13. # lemmatizing and removing stopwords
  14. text = [wn.lemmatize(word) for word in tokens if word not in stopwords]
  15. # converting token list into synset
  16. syns = [text.lemmas()[0].name() for text in wn.synsets(text)]
  17. return text
  18.  
  19. syns = [text.lemmas()[0].name() for text in wn.synsets(text)]
  20. AttributeError: 'WordNetLemmatizer' object has no attribute 'synsets'
Add Comment
Please, Sign In to add comment