Preparing Text for Language Tasks
Explore tokens, normalisation, stemming, and lemmatisation with a small sentence.
artificial intelligence, nlp, tokenisation, languageA sentence as data
Suppose a library wants to find notes about running. A computer can process the sentence “Dogs were running” as text, but first needs a way to represent it. Natural language processing (NLP) works with human language; tasks include finding documents, translation and answering questions.
Follow one preparation
- A simple word tokenizer splits “Dogs were running” into
Dogs,were,running. - Lowercasing gives
dogs,were,running. - A lemmatiser with appropriate context might map these to
dog,be,run. Actual results depend on the tool and its language information.
See the reasoning
Follow the example one step at a time
Prepare one sentence using an illustrative word tokenizer. This is a prepared teaching demonstration, not live code execution.
Split
Dogs were running → Dogs | were | running
This tokenizer chooses three word tokens; other tokenizers make different choices.
Different ways to split and simplify
A token is a unit chosen by a tokenizer. Some use words; others use subwords or characters. Punctuation, languages without spaces, and contractions require choices. A stemmer may remove endings using rules and produce a fragment that is not a word. A lemmatiser aims for a dictionary form and may need a word's grammatical role.
Normalisation can make related forms easier to match, but can also discard meaning: case may matter for names and punctuation for tone. No single preparation is best for every task. Check the original text and evaluate changes on the languages and users the system is intended to support.
Reflect on the concept
Four fixed questions to reinforce the reasoning. Answers are not saved or scored.
