
keyIt fixed
By:
ace on
Feb 6th, 2010 | syntax:
None | size: 0.92 KB | hits: 21 | expires: Never
public String generateResponse(HashSet<String> words)
{
Iterator<String> it = words.iterator();
while(it.hasNext())
{
String word = it.next();
ArrayList<String> keys = new ArrayList<String>();
keys.addAll(responseMap.keySet());
while(keys.hasNext())
{
String key = keys.next();
if (word.contains(key))
{
String response = responseMap.get(word);
}
}
if(response != null)
{
return response;
}
}
// If we get here, none of the words from the input line was recognized.
// In this case we pick one of our default responses (what we say when
// we cannot think of anything else to say...)
return pickDefaultResponse();
}