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