Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
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 (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.

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 studying the Monastery: (3)
As of 2015-07-04 05:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (57 votes), past polls