Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

println for debug

By: ace on Feb 10th, 2010  |  syntax: None  |  size: 1.05 KB  |  hits: 18  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.  public String generateResponse(HashSet<String> words)
  2.     {
  3.         for(String word : words){
  4.             System.out.println(word);
  5.         }
  6.        String response = null;
  7.         if (words.contains("Are you a person?"))
  8.             {
  9.                 response = "Of course I am a person.";
  10.             }
  11.         Iterator<String> it = words.iterator();        
  12.         while(it.hasNext()) {
  13.             String word = it.next();
  14.             ArrayList<String> keys = new ArrayList<String>();
  15.             keys.addAll(responseMap.keySet());
  16.             for(String s : keys){
  17.                 if(word.contains(s)){
  18.                     response = responseMap.get(s);
  19.                 }
  20.             }
  21.             if(response != null) {
  22.                 return response;
  23.             }
  24.         }
  25.         // If we get here, none of the words from the input line was recognized.
  26.         // In this case we pick one of our default responses (what we say when
  27.         // we cannot think of anything else to say...)
  28.         return pickDefaultResponse();
  29.     }