📜  spacy 获取令牌数量 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:06.804000             🧑  作者: Mango

代码示例1
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