Classical NLPNLP 03
Tokenization
Before a program can count or compare words, text has to be split into tokens and normalised. This panel runs the pipeline that every other demo on this site uses: split the text into words, lowercase them, remove stopwords (very common words such as “the” and “is”), and reduce each word to a stem with Porter’s algorithm, so that related forms such as “randomised” and “randomisation” count as the same term. Type your own text to see each step.
Raw Tokens
Lowercased Tokens
Tokens Without Stopwords
Stemmed Tokens
How stemming works
Porter’s stemmer (1980) strips suffixes in five steps of rules, each applied only if enough of the word remains. It is fast and needs no dictionary, but its stems are not always real words (“this” → thi, “sample” → sampl), it misses irregular forms (“ran” and “run” stay apart), and it was written for American spelling: “randomised” becomes randomis but “randomized” becomes random. Lemmatisation, which maps words to their dictionary form, is the more linguistic alternative.
In practice
Every choice here changes what later steps see. “Not” and “no” are on the stopword list, so “not significant” loses the word that matters most. Medical text is full of tokens that simple rules handle unevenly: this tokenizer keeps “67-year-old”, “COVID-19” and “HbA1c” whole but splits “7.2%” into 7 and 2. Modern language models skip stemming and stopwords altogether and split text into subword pieces instead.
References
- Porter, M. F. (1980). An algorithm for suffix stripping. Program, 14(3), 130–137. doi.org/10.1108/eb046814
- Manning, C. D., Raghavan, P., & Schütze, H. (2008). Introduction to Information Retrieval. Cambridge University Press. Chapter 2: The term vocabulary and postings lists. Free online: nlp.stanford.edu/IR-book