summaryrefslogtreecommitdiff
path: root/spellchecker/src/SpellChecker.java
diff options
context:
space:
mode:
Diffstat (limited to 'spellchecker/src/SpellChecker.java')
-rw-r--r--spellchecker/src/SpellChecker.java17
1 files changed, 16 insertions, 1 deletions
diff --git a/spellchecker/src/SpellChecker.java b/spellchecker/src/SpellChecker.java
index 6550678..055326e 100644
--- a/spellchecker/src/SpellChecker.java
+++ b/spellchecker/src/SpellChecker.java
@@ -9,6 +9,9 @@ public class SpellChecker {
*/
public static void main(String[] args) {
boolean inPeach = true; // set this to true if you submit to peach!!!
+ if (System.getenv("NO_PEACH") != null) {
+ inPeach = false;
+ }
try {
CorpusReader cr = new CorpusReader();
@@ -17,7 +20,8 @@ public class SpellChecker {
if (inPeach) {
peachTest(sc);
} else {
- nonPeachTest(sc);
+ continuousTest(sc);
+ //nonPeachTest(sc);
}
} catch (Exception ex) {
System.out.println(ex);
@@ -25,6 +29,17 @@ public class SpellChecker {
}
}
+ static void continuousTest(SpellCorrector sc) {
+ Scanner input = new Scanner(System.in);
+ while (input.hasNextLine()) {
+ String s0 = input.nextLine();
+ System.out.println("Input : " + s0);
+ String result = sc.correctPhrase(s0);
+ System.out.println("Answer: " + result);
+ System.out.println();
+ }
+ }
+
static void nonPeachTest(SpellCorrector sc) throws IOException {
String[] sentences = {
"at the hme locations there were traces of water"