protected boolean slotsContainNumberSlotWithValue(Map<String, Slot> slots, String value) { Slot slot = slots.get(SlotNames.NUMBER_SLOT_NAME); return (slot != null) && slot.getValue().equals(value); }
protected boolean slotsContainNumberSlotWithValue(Map<String, Slot> slots, String value) { Slot slot = slots.get(SlotNames.NUMBER_SLOT_NAME); return (slot != null) && slot.getValue().equals(value); }
public String getSlotSummary() { final List<String> slotValues = slots.values().stream().map(slot -> slot.getName() + ": " + slot.getValue()).collect(Collectors.toList()); return slotValues.isEmpty() ? "" : "{ " + String.join(", ", slotValues) + " }"; }
/** * Function to accept an intent containing a Day slot (date object) and return the Calendar * representation of that slot value. If the user provides a date, then use that, otherwise use * today. The date is in server time, not in the user's time zone. So "today" for the user may * actually be tomorrow. * * @param intent * the intent object containing the day slot * @return the Calendar representation of that date */ private Calendar getCalendar(Intent intent) { Slot daySlot = intent.getSlot(SLOT_DAY); Date date; Calendar calendar = Calendar.getInstance(); if (daySlot != null && daySlot.getValue() != null) { DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-d"); try { date = dateFormat.parse(daySlot.getValue()); } catch (ParseException e) { date = new Date(); } } else { date = new Date(); } calendar.setTime(date); return calendar; }
@Override public SpeechletResponse handle(final SkillRequestInformation skillRequestInformation) { Map<String,Slot> slots = skillRequestInformation.getSlots(); String intentName = skillRequestInformation.getIntentName(); Slot templateKindSlot = slots.get(SlotNames.TEMPLATE_KIND_SLOT_NAME); Slot numberSlot = slots.get(SlotNames.NUMBER_SLOT_NAME); TemplateNames name; if (IntentNames.INDIVIDUAL_TEMPLATE_INTENT.equals(intentName)) { name = TemplateNames.getNameFromKindAndNumber(templateKindSlot.getValue(), numberSlot.getValue()); } else if (IntentNames.SELECT_ITEM_INTENT.equals(intentName)) { name = TemplateNames.getNameFromNumber(numberSlot.getValue()); } else { throw new UnhandledRequestException(String.format("IndividualTemplateScreen could not handle intent: %s", intentName)); } return getIndividualTemplateScreenResponse(name); }
@Override public SpeechletResponse handle(final SkillRequestInformation skillRequestInformation) { Map<String,Slot> slots = skillRequestInformation.getSlots(); String intentName = skillRequestInformation.getIntentName(); Slot templateKindSlot = slots.get(SlotNames.TEMPLATE_KIND_SLOT_NAME); Slot numberSlot = slots.get(SlotNames.NUMBER_SLOT_NAME); TemplateNames name; if (IntentNames.INDIVIDUAL_TEMPLATE_INTENT.equals(intentName)) { name = TemplateNames.getNameFromKindAndNumber(templateKindSlot.getValue(), numberSlot.getValue()); } else if (IntentNames.SELECT_ITEM_INTENT.equals(intentName)) { name = TemplateNames.getNameFromNumber(numberSlot.getValue()); } else { throw new UnhandledRequestException(String.format("IndividualTemplateScreen could not handle intent: %s", intentName)); } return getIndividualTemplateScreenResponse(name); }
String favoriteColor = favoriteColorSlot.getValue(); session.setAttribute(COLOR_KEY, favoriteColor); speechText =
List<ColumnName> axes = new ArrayList<>(); if (intent.getSlot(SlotUtil.PLOT_COLUMN_1).getValue() != null) { axes.add(SlotUtil.parseColumnSlot( intent.getSlot(SlotUtil.PLOT_COLUMN_1).getValue())); if (intent.getSlot(SlotUtil.PLOT_COLUMN_2).getValue() != null) { axes.add(SlotUtil.parseColumnSlot( intent.getSlot(SlotUtil.PLOT_COLUMN_2).getValue()));
String favoriteColor = favoriteColorSlot.getValue(); session.setAttribute(COLOR_KEY, favoriteColor); speechText =
ScoreKeeperTextUtil.getPlayerName(intent.getSlot(SLOT_PLAYER_NAME).getValue()); if (newPlayerName == null) { String speechText = "OK. Who do you want to add?";
ScoreKeeperTextUtil.getPlayerName(intent.getSlot(SLOT_PLAYER_NAME).getValue()); if (newPlayerName == null) { String speechText = "OK. Who do you want to add?";