mutters-templated-intent/src/main/java/com/rabidgremlin/mutters/templated/TemplatedIntent.java
public TemplatedUtteranceMatch matches(String[] input, Context context)
  {   
    for (TemplatedUtterance utterance : utterances)
    {   
      TemplatedUtteranceMatch match = utterance.matches(input, slots, context);
      if (match.isMatched())
      {     
        // matched utterance didn't fill in all the slots so check for default values
        if (match.getSlotMatches().size() != slots.getSlots().size())
        {       	
           // grab all the matched slots	
           HashMap<Slot, SlotMatch> matchedSlots = match.getSlotMatches();
           
           // loop through each slot
           for (Slot slot: slots.getSlots())
           {        	
        	   // does slot have default value and no match ?
        	   if (slot instanceof DefaultValueSlot && !matchedSlots.containsKey(slot))
        	   {
        		   // yep create a slot match with default value
        		   Object defaultValue = ((DefaultValueSlot)slot).getDefaultValue();
        		   matchedSlots.put(slot, new SlotMatch(slot,defaultValue == null?"":defaultValue.toString(),defaultValue));        	
        	   }
           }
        }
        
        return match;
      }
    }
    
    return new TemplatedUtteranceMatch(false);
  }
/**
   * Processes the supplied input and attempts to match against the utterance templates for the intent.
   * 
   * @param input The user's input.
   * @param context The user's context.
   * @return The templated utterance match.
   */
Processes the supplied input and attempts to match against the utterance templates for the intent.

@param input The user's input.
@param context The user's context.
@return The templated utterance match.
Processes the supplied input and attempts to match against the utterance templates for the intent . @param input The user ' s input . @param context The user ' s context . @return The templated utterance match .
public TemplatedUtteranceMatch matches(String[] input, Context context)
  {   
    for (TemplatedUtterance utterance : utterances)
    {   
      TemplatedUtteranceMatch match = utterance.matches(input, slots, context);
      if (match.isMatched())
      {     
        if (match.getSlotMatches().size() != slots.getSlots().size())
        {       	
           HashMap<Slot, SlotMatch> matchedSlots = match.getSlotMatches();
           for (Slot slot: slots.getSlots())
           {        	
        	   if (slot instanceof DefaultValueSlot && !matchedSlots.containsKey(slot))
        	   {
        		   Object defaultValue = ((DefaultValueSlot)slot).getDefaultValue();
        		   matchedSlots.put(slot, new SlotMatch(slot,defaultValue == null?"":defaultValue.toString(),defaultValue));        	
        	   }
           }
        }
        return match;
      }
    }
    return new TemplatedUtteranceMatch(false);
  }
public TemplatedUtteranceMatch matches ( String [ ] input , Context context ) { for ( TemplatedUtterance utterance : utterances ) { TemplatedUtteranceMatch match = utterance . matches ( input , slots , context ) ; if ( match . isMatched ( ) ) { if ( match . getSlotMatches ( ) . size ( ) != slots . getSlots ( ) . size ( ) ) { HashMap < Slot , SlotMatch > matchedSlots = match . getSlotMatches ( ) ; for ( Slot slot : slots . getSlots ( ) ) { if ( slot instanceof DefaultValueSlot && ! matchedSlots . containsKey ( slot ) ) { Object defaultValue = ( ( DefaultValueSlot ) slot ) . getDefaultValue ( ) ; matchedSlots . put ( slot , new SlotMatch ( slot , defaultValue == null ? "" : defaultValue . toString ( ) , defaultValue ) ) ; } } } return match ; } } return new TemplatedUtteranceMatch ( false ) ; }
Processes the supplied input and attempts to match against the utterance templates for the intent.
Processes the supplied input and attempts to match against the utterance templates for the intent .
// matched utterance didn't fill in all the slots so check for default values
 // grab all the matched slots	
 // loop through each slot
 // does slot have default value and no match ?
 // yep create a slot match with default value
