0Pricing
NLP Academy · Lesson

Counting Words and Characters

Basic length and frequency measurements.

Measuring Text First

Before any fancy analysis, you measure text. Simple counts of characters and words already tell you a lot about a document. 📏

Count Characters With len

The len function returns how many characters a string holds, including spaces and punctuation.

text = "NLP is fun"
print(len(text))  # 10

All lessons in this course

  1. Strings, Characters, and Encodings
  2. Reading Text Files Into Python
  3. Counting Words and Characters
  4. Building Your First Word Frequency Table
← Back to NLP Academy