CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Regular Expressions:
count sentences in document


New User

Oct 16, 2006, 11:03 PM

Post #1 of 2 (5159 views)
count sentences in document Can't Post

this is a second topic. i asking again

i have a file "test.txt" and contain
sentences one , sentence two . sentence three
aon two three.
laerning perl , with lingua . blaaaaaaaaaaaaa.
blaaaa. dsadsad.
strill learning .sdaasdsad.dsadsadasd

and in my case , <text> .. </text> we can say that "document"

and i want to count each sentence in document

my coding :

use HTML::TokeParser;
my $file="test.txt";
my $seleksi=HTML::TokeParser->new($file);
my $j=0;
while ($seleksi->get_tag('text')){
print $seleksi->get_text(),"\n";
print "count document are " , $j;

i want to combine to count sentence . may be result is

document 1 = sum count sentence= 2
document 2 = sum count sentence =3
document 3 =sum count sentence =4

sorry for my bad english

(This post was edited by andrewumb on Oct 16, 2006, 11:05 PM)

Thaumaturge / Moderator

Oct 17, 2006, 3:27 AM

Post #2 of 2 (5156 views)
Re: [andrewumb] count sentences in document [In reply to] Can't Post


Dave Cross, Perl Hacker, Trainer and Writer
Get more help at Perl Monks


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives