Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: Split a paragraph based on the number of letters

by Not_a_Number (Parson)
on Feb 04, 2014 at 18:55 UTC ( #1073453=note: print w/ replies, xml ) Need Help??


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.


Comment on Re^2: Split a paragraph based on the number of letters
Select or Download Code
Re^3: Split a paragraph based on the number of letters
by kennethk (Monsignor) 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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1073453]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (9)
As of 2014-09-23 19:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (239 votes), past polls