Help, How to detect the end of sentence in a plain text

Hi, Everyboday

I really don't know how to use ArrayList and endsWith to realize detecting the following question. Could you give me some help? Thank you!

1. find the end of the sentence. that means that we print it out if you meet "!" or "." .....

2. calculating the frequency of the key word in the whole text. maybe using IDF..

import java.io.*;

class SearchEnd{

public static void main (String[] args){

try{

File myFile = new File("Test.txt");

FileReader fileReader = new FileReader(myFile);

BufferedReader reader = new BufferedReader(fileReader);

String line = null;

while ((line = reader.readLine()) != null){

System.out.println(line);

}

reader.close();

}catch (FileNotFoundException exception){

System.err.println("File not found");

}catch(IOException exception){

System.err.println("IO Error");

}

}

}

[947 byte] By [lauehuanga] at [2007-9-29 13:20:46]
# 1

Checkout this thread about how to use these forums effectively. Particularly with College home type questions, expected to be taught how to find the answer rather than be given it outright.

http://forum.java.sun.com/thread.jsp?forum=54&thread=190747

-- Question

There are lots of ways to do this, check out the API documentation http://java.sun.com/j2se/1.4.2/docs/api/

Your sample shows you can iterate the string so checkout these three classes.

http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html

http://java.sun.com/j2se/1.4.2/docs/api/java/lang/StringBuffer.html

http://java.sun.com/j2se/1.4.2/docs/api/java/util/StringTokenizer.html

MartinS.a at 2007-7-15 3:34:48 > top of Java-index,Other Topics,Algorithms...