Loading src/main/java/edu/bu/LanguageCorrection/Corrector.java +7 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,13 @@ public class Corrector { // Divide sentence into words String[] words = inputSentence.split(" "); // Check if all words are in the trie for (int i = 0; i < words.length; i++) { if (!detector.containsWord(words[i])) { continue; } } List<String> sentences = generateSentences(words); // Use a priority queue to store sentences along with their scores Loading src/main/java/edu/bu/LanguageCorrection/TrieNode.java +10 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,16 @@ public class TrieNode implements Serializable, Cloneable { past.childCounts += 1; } public boolean containsWord(String word) { return this.children.containsKey(word); } public String findClosestWord(String word) { String[] children = this.children.keySet().toArray(new String[0]); return ""; } public float probability(String phrase) { String[] words = phrase.split(" "); if (words.length <= 1) { // If word does not exist in trie Loading Loading
src/main/java/edu/bu/LanguageCorrection/Corrector.java +7 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,13 @@ public class Corrector { // Divide sentence into words String[] words = inputSentence.split(" "); // Check if all words are in the trie for (int i = 0; i < words.length; i++) { if (!detector.containsWord(words[i])) { continue; } } List<String> sentences = generateSentences(words); // Use a priority queue to store sentences along with their scores Loading
src/main/java/edu/bu/LanguageCorrection/TrieNode.java +10 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,16 @@ public class TrieNode implements Serializable, Cloneable { past.childCounts += 1; } public boolean containsWord(String word) { return this.children.containsKey(word); } public String findClosestWord(String word) { String[] children = this.children.keySet().toArray(new String[0]); return ""; } public float probability(String phrase) { String[] words = phrase.split(" "); if (words.length <= 1) { // If word does not exist in trie Loading