spacy-doc-object

05-09-2022 || 23:31
Tags: #nlp #spacy

spacy-doc-object

In spacy, you can initialize any object with the text like these

import spacy

nlp = spacy.blank('en')

doc = nlp('I live nlp.')

for token in doc:
	print(token.i)          # index
	print(token.text)       # text
	print(token.is_alpha)   # is alpha
	print(token.is_punct)   # is punctuation
	print(token.like_num)   # is a number

References

Advanced NLP with Scipy