📜  spacy text annotation dict理解 - Python代码示例

📅  最后修改于: 2022-03-11 14:46:59.491000             🧑  作者: Mango

代码示例1
import spacy
nlp = spacy.load('en_core_web_sm') # or some other model

text_to_be_annotated = nlp('Put your long to-be-annotated text here')

# pos: part-of-speech tagging
# lemma: base form of the word
# vector: embedding of the token (optional)
annotated_text = {token : (token.pos_, token.lemma_, token.vector) 
                  for token in text_to_be_annotated}