Skip to content
πŸ› οΈToolsShed

Duplicate Word Finder

Find repeated words in text with frequency counts and positions.

About this tool

The Duplicate Word Finder is a tool that identifies and highlights repeated words within any text, displaying their frequency counts and exact positions. Detecting duplicate words is valuable for writers, editors, and content creators who want to improve writing quality, ensure variety in word choice, and catch unintended repetitions that can make prose feel awkward or redundant.

Simply paste or type your text into the input field, and the tool instantly analyzes it to find all repeated words. Results are presented in a clear table showing each duplicate word, how many times it appears, and where in the text it occurs. This makes it easy to review repetitions and decide whether each instance serves a purpose or should be replaced with a synonym for better flow and readability.

This tool is especially useful for novelists, journalists, academic writers, and anyone polishing their writing for publication. Whether you are editing a blog post, dissertation, or marketing copy, the Duplicate Word Finder helps you identify unintended word patterns and maintain professional, engaging prose that holds your reader's attention.

Frequently Asked Questions

Code Implementation

import re
from collections import Counter

def find_duplicates(text: str, case_sensitive: bool = False) -> dict:
    """Find duplicate words and their positions in text."""
    processed = text if case_sensitive else text.lower()
    words = re.findall(r'\b[a-zA-Z]+\b', processed)
    freq = Counter(words)
    duplicates = {word: count for word, count in freq.items() if count > 1}

    # Find positions (1-based word index)
    positions = {word: [] for word in duplicates}
    for i, word in enumerate(words, 1):
        if word in positions:
            positions[word].append(i)

    return {
        'duplicates': sorted(duplicates.items(), key=lambda x: -x[1]),
        'positions': positions,
        'total_words': len(words),
        'unique_words': len(freq),
    }

text = "The cat sat on the mat and the cat was happy"
result = find_duplicates(text, case_sensitive=False)
for word, count in result['duplicates']:
    print(f"'{word}' appears {count} times at positions {result['positions'][word]}")

Comments & Feedback

Comments are powered by Giscus. Sign in with GitHub to leave a comment.