lib/megahal/megahal.rb
# Given an array of utterances and an array of keywords, select the best
# utterance (returning nil for none at all).
Given an array of utterances and an array of keywords, select the best
utterance (returning nil for none at all).
Given an array of utterances and an array of keywords select the best utterance ( returning nil for none at all ) .
def _select_utterance(utterances, keyword_symbols)
    best_score = -1
    best_utterance = nil
    utterances.each do |utterance|
      score = _calculate_score(utterance, keyword_symbols)
      next unless score > best_score
      best_score = score
      best_utterance = utterance
    end
    return best_utterance
  end
def _select_utterance ( utterances , keyword_symbols ) best_score = - 1 best_utterance = nil utterances . each do | utterance | score = _calculate_score ( utterance , keyword_symbols ) next unless score > best_score best_score = score best_utterance = utterance end return best_utterance end
Given an array of utterances and an array of keywords, select the best
utterance (returning nil for none at all).
Given an array of utterances and an array of keywords select the best utterance ( returning nil for none at all ) .
utterances
keyword_symbols