I am trying to get the actual output from the generator but i get the ouput as generator object. Please help me achieve the actual output from the generator
import spacy
nlp = spacy.load('en')
def lemmatizer(words):
yield from [w.lemma_ for w in nlp(words)]
list1 = ['birds hanging on street','people playing cards']
a = list(map(lemmatizer,list1))
Output:
a
[<generator object....>,
<generator object....>]
Expected output:
a
['birds hang on street',
'people play card']
This worked for me with the help of @PatrickArtner comment
a = list(map(list, map(lemmatizer,list1)))
b = list(map(' '.join, a))