📅  最后修改于: 2022-03-11 14:46:06.804000             🧑  作者: Mango
import spacy
nlp = spacy.load("en_core_web_sm") # or a different available model
s = "This is my beautiful string"
# spaCy counts the number of tokens such as
# words, numbers, puntuation marks etc.
len(nlp(s))
>>> 5