Permalink
Browse files

uses debug to print

  • Loading branch information...
esussman committed Apr 17, 2012
1 parent b46b86f commit 4f3510930ecf5cb869d60789e652a7086b9f9f33
@@ -4,6 +4,7 @@
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
+import customerSearch.util.Debug;
public class ExactMatch implements SearchStrategy
{
@@ -35,7 +36,7 @@ public void search(ArrayList<String> description)
{
if(sentence.indexOf(search) != -1)
- System.out.println(sentence);
+ Debug.dprint(sentence, 1);
}
}
@@ -4,6 +4,7 @@
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.util.ArrayList;
+import customerSearch.util.Debug;
public class NaiveMatching implements SearchStrategy
{
@@ -35,15 +36,15 @@ public void search(ArrayList<String> description)
for (String search: result)
{
-
+
for(String sentence: description)
{
String[] splitSentence = sentence.split(" ");
-
+
for(String word: splitSentence)
{
if(word.compareToIgnoreCase(search) == 0)
- System.out.println(sentence);
+ Debug.dprint(sentence, 1);
}
}
}
@@ -5,6 +5,7 @@
import java.io.FileNotFoundException;
import java.util.HashMap;
import java.util.Scanner;
+import customerSearch.util.Debug;
public class SemanticMatch implements SearchStrategy
{
@@ -62,36 +63,36 @@ public void search(ArrayList<String> description)
{
ArrayList<String> result = new ArrayList<String>();
-
+
//Gets the last word from each sentence
//and puts it into an array list
for(String first: searchStrings)
{
String[] split = first.split(" ");
result.add(split[split.length-1]);
}
-
+
//Takes every last word found found
//and checks if it exists as a key
//inside the hashmap
for(String keyword : result)
{
-
+
if(synonyms.containsKey(keyword))
{
//If it does, we search the description
//of the object with the value matching the key found
for(String sentence : description)
{
-
+
if(sentence.indexOf(synonyms.get(keyword)) != -1)
- System.out.println(sentence);
-
+ Debug.dprint(sentence, 1);
+
}
-
-
+
+
}
-
+
}
}

0 comments on commit 4f35109

Please sign in to comment.