我正在尝试从生成器获取实际输出,但我将输出作为生成器对象。请帮我实现生成器的实际输出
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))
输出:
a
[<generator object....>,
<generator object....>]
预期输出:
a
['birds hang on street',
'people play card']