Untitled
Anonymous
plain_text
08/24/2023 11:42 AM
376 B
16
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 nounsEditor is loading...