direhack

direhack

  • NA
  • 1
  • 0

Sentence parsing

Feb 9 2008 3:57 PM
Hi everyone,
I have a problem with parsing a text file into my program. The input is in a text file with sentences. Each sentence can either be on a separate line, or it can be Following the previous sentece on the same line. What I need to do is to read the whole file and then cut it up into single sentences that I can put in String[] array. For example, a file can be like this:

This is a sentence. This is another sentence.
This is a third sentence.
Fourth sentence.

However, the trick is that I want my program to read sentences that have periods inside them that do not terminate that sentence, for example:

This sentence will end at 3 p.m. on February 20th.

I was looking into regular expressions and just string.indexof() methods, but I cannot get far with them.

Thank you for all your help.


Answers (2)