Question: I want to detect sentences, long phrases, and possibly paragraphs that have been repeated in a document. I've been working on a document, and want to make sure I haven't copied the same or similar text into more than one spot.

Ideally, the application should be available online, or easily installable on an OS X Mavericks computer with Pages but not Microsoft Word installed.

I came across [Pro Writing Aid](https://prowritingaid.com/), but its "Repeat Words & Phrases" seems to me very noisy - some individual words are highlighted by it merely for occurring a fair bit.

I have also seen Online-Utility.org's [Text Analyzer](http://www.online-utility.org/text/analyzer.jsp), which isn't bad. However, there is some redundancy in its information. If there's a seven word phrase that's repeated twice, it also mentions the two six word phrases consisting of words one to six and two to seven as occurring twice. Also, it's hard to visualise the results, and see if there are particular sections that have a high amount of duplicated text.

This question is different from [Program to search for word repetitions in text documents](https://softwarerecs.stackexchange.com/questions/11423/program-to-search-for-word-repetitions-in-text-documents) and [Program to search for word repetitions in Word documents](https://softwarerecs.stackexchange.com/questions/11420/program-to-search-for-word-repititions-in-word-documents) in that they're asking about one word being repeated by the following word.

Answer: 
Maybe you can try this code:

<https://github.com/raypereda/repeating-phrases>
(I'm not the developer of "repeating-phrases")

Other option is to try some shell script (macOS, linux).

```
cat ./THEFILE.txt | tr '\n' ' ' | tr -d '\b\r' | tr -s ' ' | gsed 's/\([.!?]\) \(.\)/\1\n\2/g' | grep -v -e '^$' | sort | uniq -c | sort -nr | head -5

```

Note: using "gsed" because of macOS.
Explanation:

```
tr '\n' ' ' -> strip "\n" (merge lines)
tr -d '\b\r' -> remove control chars if exists
tr -s ' ' -> multiple spaces in sequence became just one space
gsed 's/\([.!?]\) \(.\)/\1\n\2/g' -> one phrase in each line (punctuation based)
grep -v -e '^$' -> strip blank lines
sort | uniq -c | sort -nr | head -20 -> statistics

```

Both solutions assume plain text files for input.
Textanz can do that (find and highlight repeated text blocks in a document).

<http://www.textanz.com/index.php>

[![https://i.imgur.com/1giwJZ1.jpg](https://i.stack.imgur.com/XS0DW.jpg)](https://i.stack.imgur.com/XS0DW.jpg)