ace

keyIt fixed

ace
Feb 6th, 2010
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. public String generateResponse(HashSet<String> words)
  2. {
  3. Iterator<String> it = words.iterator();
  4. while(it.hasNext())
  5. {
  6. String word = it.next();
  7. ArrayList<String> keys = new ArrayList<String>();
  8. keys.addAll(responseMap.keySet());
  9. while(keys.hasNext())
  10. {
  11. String key = keys.next();
  12. if (word.contains(key))
  13. {
  14. String response = responseMap.get(word);
  15. }
  16. }
  17. if(response != null)
  18. {
  19. return response;
  20. }
  21.  
  22. }
  23. // If we get here, none of the words from the input line was recognized.
  24. // In this case we pick one of our default responses (what we say when
  25. // we cannot think of anything else to say...)
  26. return pickDefaultResponse();
  27. }
Advertisement
Add Comment
Please, Sign In to add comment