Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

spacy text annotation dict comprehension

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}
Source by jupyterhub.yadasup.development.te.int #
 
PREVIOUS NEXT
Tagged: #spacy #text #annotation #dict #comprehension
ADD COMMENT
Topic
Name
8+1 =