When removing repeated words changes your meaning
Writing
A repeated word is not always a mistake. Articles, pronouns and names recur naturally in paragraphs. Removing every repeated word from a passage can make it hard to read.
Compare these two edits
Input: The cat watched the bird. The bird flew away. Every repeat removed, ignoring case: The cat watched bird. bird flew away.
This treats every space-separated token as a word and keeps the first spelling. The later “the” and “The” disappear, so both sentences lose words they need. “bird” survives only because the first copy is “bird.”, with a full stop, which counts as a different word. A proofreader would have left all of these repetitions alone.
Accidental doubled words are a narrower problem
“Please check the the address” is a different kind of mistake. Removing one of the two neighbouring copies gives a normal sentence. That is what Adjacent repeats only does in the duplicate word remover: it compares each word only with the word directly before it.
Input: Please check the the address. Adjacent repeats only: Please check the address.
Even neighbouring repeats need a person to check them. “What she had had was enough” contains a correct double “had”, and a quotation may repeat a word on purpose. A tool cannot always infer what the writer meant.
Use word deduplication for a word inventory
Removing every repeat is useful when you want a list of unique words from a text, such as a set of tags.
Input: red blue red green Unique words: red blue green
Decide how punctuation should behave before calling the result a vocabulary list. Under a simple space-based rule, “green” and “green.” are different words.
How to check repeated words in a paragraph
- Work on a copy of the text.
- Run Adjacent repeats only to catch doubled words, and compare the counts: the number removed is the number of doubles found.
- Read each changed sentence and put back any repeat that belongs there.
- Read the paragraph aloud. Counts tell you how much was removed; they cannot tell you whether the paragraph still says what you meant.
If you are comparing a list of full sentences, put each sentence on its own line and use the duplicate line remover, so each sentence stays intact.