Reading the first sentence


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 8 of 8

Thread: Reading the first sentence

Hybrid View

  1. #1
    Join Date
    Feb 2006
    Posts
    13

    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.

  2. #2
    Join Date
    Mar 2005
    Location
    UK, London
    Posts
    150
    What is the format of the news how do you read the news from yahoo at the moment.

  3. #3
    Join Date
    Feb 2006
    Posts
    13
    Right now I am using HTML parser to parse the html page and get to the textual content

  4. #4
    Join Date
    Mar 2004
    Posts
    635
    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("."));

  5. #5
    Join Date
    Dec 2005
    Location
    New Jersey
    Posts
    290
    Quote Originally Posted by Phaelax
    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.

  6. #6
    Join Date
    Feb 2006
    Posts
    13
    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.

  7. #7
    Join Date
    Mar 2004
    Posts
    635
    Maybe search for a tab that indents a new paragraph? \t

  8. #8
    Join Date
    Dec 2005
    Posts
    48
    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/

Similar Threads

  1. java problem
    By Transform in forum Java
    Replies: 0
    Last Post: 11-18-2005, 06:54 PM
  2. Replies: 2
    Last Post: 11-14-2001, 01:49 PM
  3. Reading - UML in 24 Hours & Code Complete
    By Rich in forum Architecture and Design
    Replies: 0
    Last Post: 10-03-2001, 09:27 AM
  4. Replies: 0
    Last Post: 11-19-2000, 08:16 PM
  5. Example for Reading other apps process memory space
    By Lior Amar in forum VB Classic
    Replies: 0
    Last Post: 06-27-2000, 07:47 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center