in reply to Finding duplicate text in a paragraph

I'm inclined to use Lingua::EN::Sentence to get the sentences, since it's a well-developed module for that purpose. Given this, perhaps the following will help:

use Modern::Perl; use Lingua::EN::Sentence qw( get_sentences ); my ( $LRS, %seen ) = ''; my $sentences = 'Mr. Cat jumped over the dog. Smart Mr. Cat! He jumped + over the dog. Mr. Cat jumped over the dog.'; map { $seen{$_}++ and length $_ > length $LRS and $LRS = $_ } @{ get_sentences($sentences) }; say $LRS;

Output:

Mr. Cat jumped over the dog.

Update: Modified some sentences to challenge Lingua::EN::Sentence.

Replies are listed 'Best First'.
Re^2: Finding duplicate text in a paragraph
by Jester (Novice) on Aug 20, 2012 at 20:43 UTC
    Interesting module, I'll look into in, thank you.