http://www.perlmonks.org?node_id=1073453


in reply to Re: Split a paragraph based on the number of letters
in thread Split a paragraph based on the number of letters

I agree that the OP is not very clear. However, if the intention is actually to split a paragraph into sentences, I would strongly recommend using a module rather than trying to roll one's own parser.

Here's an example using Lingua::EN::Sentence:

use Lingua::EN::Sentence qw( get_sentences ); my $text = 'Is Mr. Hyde in? A. J. Smith Ph.D. said "Drop dead!"'; my $sentences = get_sentences($text); say for @$sentences;

Output:

Is Mr. Hyde in? A. J. Smith Ph.D. said "Drop dead!"

Update: Minor wording changes; added output.

Replies are listed 'Best First'.
Re^3: Split a paragraph based on the number of letters
by kennethk (Abbot) on Feb 04, 2014 at 19:15 UTC

    I whole-heartedly agree. I also think the post had all the hallmarks of homework, and I suspect the professor would not accept a practical solution.


    #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.