0

i want to write the program to examine word by using nltk corpus but i don't know why some word that nltk should have but it not.

this is my code.

import nltk

word = "women"
words = set(nltk.corpus.words.words())
if word in words:
    print(word)

and the output is show nothing.

Kaow
  • 483
  • 2
  • 9
  • 22
  • 2
    try "woman" (as in: singular - not plural) – Patrick Artner Sep 12 '19 at 11:50
  • @Patrick Artner thank you for response, and how can i check if this is a word not only as in singular because i just want to clean junk word in my data. – Kaow Sep 12 '19 at 12:23
  • 1
    You have to get the singular from the plural then - see f.e.[https://stackoverflow.com/questions/31387905/converting-plural-to-singular-in-a-text-file-with-python](https://stackoverflow.com/questions/31387905/converting-plural-to-singular-in-a-text-file-with-python) - you wont find a list that includes all words, singular and plural as well as re/inflected. Bring your word to the base-case and try it against curpus.words.words(). – Patrick Artner Sep 12 '19 at 13:15
  • @PatrickArtner thank you very much :) – Kaow Sep 12 '19 at 16:00

0 Answers0