Untitled
unknown
plain_text
2 years ago
281 B
5
Indexable
def noun_extraction(text): # function to test if something is a noun is_noun = lambda pos: pos[:2] == 'NN' # do the nlp stuff tokenized = nltk.word_tokenize(text) nouns = [word for (word, pos) in nltk.pos_tag(tokenized) if is_noun(pos)] return nouns
Editor is loading...