spacy nlp code example
Example 1: spacy tokenize
from spacy.tokenizer import Tokenizer
from spacy.lang.en import English
nlp = English()
tokenizer = Tokenizer(nlp.vocab)
from spacy.lang.en import English
nlp = English()
tokenizer = nlp.Defaults.create_tokenizer(nlp)
Example 2: spacy tokineze stream
texts = ["One document.", "...", "Lots of documents"]
for doc in tokenizer.pipe(texts, batch_size=50):
pass
Example 3: spacy nlp load
import spacy
nlp = spacy.load("en_core_web_sm")
Example 4: nlp spacy medium
df[‘spacy_doc’] = list(nlp.pipe(df.text))