Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Reading the first sentence

I have a program that reads news from yahoo. what I want to do is just read the first sentence from each paragraph. I dont want to store it in a file but do it at the same time that I read it from the internet. How do I do this? Any help.
[238 byte] By [Game] at [2007-11-11 7:55:03]
# 1 Re: Reading the first sentence
What is the format of the news how do you read the news from yahoo at the moment.
major at 2007-11-11 22:36:56 >
# 2 Re: Reading the first sentence
Right now I am using HTML parser to parse the html page and get to the textual content
Game at 2007-11-11 22:38:01 >
# 3 Re: Reading the first sentence
after you have the paragraph parsed from the html, just use the String commands.

String paragraph;
//parse HTML

String sentence = paragraph.substring(0,paragraph.indexOf("."));
Phaelax at 2007-11-11 22:39:00 >
# 4 Re: Reading the first sentence
after you have the paragraph parsed from the html, just use the String commands.

String paragraph;
//parse HTML

String sentence = paragraph.substring(0,paragraph.indexOf("."));

What if paragraph is "I walked over to Mr. Smith."? Also, that will leave out the period. substring is inclusive of the first argument, exclusive of the second.
destin at 2007-11-11 22:39:59 >
# 5 Re: Reading the first sentence
I just used BreakIterator class and it works fine giving sentences separately.
But how can I identify when a new paragraph comes. breakiterator class still has some disadvantage when there is a country name such as U.S. comes in between. it identifies it as a new sentence.

Any ideas to overcome these problems.
Game at 2007-11-11 22:41:09 >
# 6 Re: Reading the first sentence
Maybe search for a tab that indents a new paragraph? \t
Phaelax at 2007-11-11 22:42:02 >
# 7 Re: Reading the first sentence
Hehe,It's really a hard stuff.We don't know the rule of the news.
Maybe you can ask the Supportor of the yahoo for a help,I think they should have API for java.

JAVA EMAIL VERIFY

http://www.wisesoft.biz/
jetbrains at 2007-11-11 22:43:06 >