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");
}
}
}

