Hi guys I can't seem to get this method working. Any help is appreciated on what's wrong in my code thanks!
/** public static final String SENTENCE_SEPARATORS = "[.?!]"; * Given an ArrayList of lines from a text file, create a new array list * in which each entry is a sentence from the file * with SENTENCE_SEPARATORS removed but no other changes. * A sentence is defined to be a sequence of characters that * (1) is terminated by (but doesn't include) the characters ! ? . or the end of the file, * (2) excludes whitespace on either end, and * (3) is not empty. */ public static ArrayList<String> convertFileLinesToSentences(ArrayList<String> filelines) { String allLines = ""; for(String lines : filelines) { // add all lines into a single string allLines = (lines + " "); } String[] sentencesArray = allLines.split(SENTENCE_SEPARATORS); // split at sentence separators ArrayList<String> entries = new ArrayList<>(Arrays.asList(sentencesArray)); // add sentences from array into ArrayList for(String sentence : entries) { // remove the sentence separators sentence.trim().replaceAll(SENTENCE_SEPARATORS, ""); } return entries; }