Not a member of Pastebin yet?
                        Sign Up,
                        it unlocks many cool features!                    
                - 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();
 - }
 
Advertisement
 
                    Add Comment                
                
                        Please, Sign In to add comment