Intro to Spacy

What is Spacy?

COmmand => conda install -c conda-forge spacy

import spacy

nlp = spacy.load(‘en_core_web_sm’)
doc = nlp(u’Apple is looking at buying U.K. startup for $1 billion’)
for token in doc:
print(token.text)

Apple |is |looking |at |buying |U.K.|startup|for |$ |1|billion

CODE

import spacy

nlp = spacy.load(‘en_core_web_sm’)
doc = nlp(u’Apple is looking at buying U.K. startup for $1 billion’)

for token in doc:
print(token.text, token.lemma_, token.pos_, token.tag_, token.dep_,
token.shape_, token.is_alpha, token.is_stop)

Post a Comment

Previous Post Next Post