Loading src/main/java/edu/bu/LanguageCorrection/Corrector.java +2 −2 Original line number Diff line number Diff line Loading @@ -109,7 +109,7 @@ public class Corrector { boolean originalInTop5 = false; for (String sentence : topSentences) { sentence = sentence.split(" \\| Score: ")[0]; // Remove score System.out.println(sentence); //System.out.println(sentence); if (sentence != null && sentence.equals(inputSentence)) { originalInTop5 = true; break; Loading Loading @@ -194,7 +194,7 @@ public class Corrector { sortedList.sort(Map.Entry.comparingByValue()); for (Map.Entry<String, Integer> entry : sortedList) { System.out.println(" " + entry.getKey() + " | Changes: " + entry.getValue()); System.out.println(">> " + entry.getKey() + " | Changes: " + entry.getValue()); } } Loading src/main/java/edu/bu/LanguageCorrection/MainApp.java +7 −3 Original line number Diff line number Diff line Loading @@ -186,11 +186,15 @@ public class MainApp extends JFrame { } } if (worstPhrase != null) { if (worstPhrase != null && lowestScore > 10.0) { // Check if the worst phrase has a low enough score // Append to the result with annotations result.append("\nSentence: ").append(sentence) .append("\n>> Worst Phrase: ").append(worstPhrase) .append(" (Score: ").append(lowestScore).append(")\n"); } else { result.append("\nSentence: ").append(sentence) .append("\n>> No worst phrase found (with low enough score), the sentence is grammatically correct.\n"); worstPhrases[sentences.indexOf(sentence)] = ""; } } Loading @@ -202,7 +206,7 @@ public class MainApp extends JFrame { for (String phrase : worstPhrases) { phrase = phrase.replaceAll("\"", ""); //System.out.println(phrase); if (phrase != null) { if (phrase != null && !phrase.isEmpty()) { //System.out.println(resultArea.getText()); int start = resultArea.getText().indexOf(phrase); if (start != -1) { Loading Loading @@ -254,7 +258,7 @@ public class MainApp extends JFrame { int i = 1; for (Map.Entry<String, Integer> entry : sortedList) { result.append(" " + i + ") " + entry.getKey() + " | Changes: " + entry.getValue() + "\n"); result.append(">> " + entry.getKey() + " | Changes: " + entry.getValue() + "\n"); i++; } } Loading Loading
src/main/java/edu/bu/LanguageCorrection/Corrector.java +2 −2 Original line number Diff line number Diff line Loading @@ -109,7 +109,7 @@ public class Corrector { boolean originalInTop5 = false; for (String sentence : topSentences) { sentence = sentence.split(" \\| Score: ")[0]; // Remove score System.out.println(sentence); //System.out.println(sentence); if (sentence != null && sentence.equals(inputSentence)) { originalInTop5 = true; break; Loading Loading @@ -194,7 +194,7 @@ public class Corrector { sortedList.sort(Map.Entry.comparingByValue()); for (Map.Entry<String, Integer> entry : sortedList) { System.out.println(" " + entry.getKey() + " | Changes: " + entry.getValue()); System.out.println(">> " + entry.getKey() + " | Changes: " + entry.getValue()); } } Loading
src/main/java/edu/bu/LanguageCorrection/MainApp.java +7 −3 Original line number Diff line number Diff line Loading @@ -186,11 +186,15 @@ public class MainApp extends JFrame { } } if (worstPhrase != null) { if (worstPhrase != null && lowestScore > 10.0) { // Check if the worst phrase has a low enough score // Append to the result with annotations result.append("\nSentence: ").append(sentence) .append("\n>> Worst Phrase: ").append(worstPhrase) .append(" (Score: ").append(lowestScore).append(")\n"); } else { result.append("\nSentence: ").append(sentence) .append("\n>> No worst phrase found (with low enough score), the sentence is grammatically correct.\n"); worstPhrases[sentences.indexOf(sentence)] = ""; } } Loading @@ -202,7 +206,7 @@ public class MainApp extends JFrame { for (String phrase : worstPhrases) { phrase = phrase.replaceAll("\"", ""); //System.out.println(phrase); if (phrase != null) { if (phrase != null && !phrase.isEmpty()) { //System.out.println(resultArea.getText()); int start = resultArea.getText().indexOf(phrase); if (start != -1) { Loading Loading @@ -254,7 +258,7 @@ public class MainApp extends JFrame { int i = 1; for (Map.Entry<String, Integer> entry : sortedList) { result.append(" " + i + ") " + entry.getKey() + " | Changes: " + entry.getValue() + "\n"); result.append(">> " + entry.getKey() + " | Changes: " + entry.getValue() + "\n"); i++; } } Loading