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.
Printable View
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.
What is the format of the news how do you read the news from yahoo at the moment.
Right now I am using HTML parser to parse the html page and get to the textual content
after you have the paragraph parsed from the html, just use the String commands.
Code: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.Quote:
Originally Posted by Phaelax
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.
Maybe search for a tab that indents a new paragraph? \t
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/