/** * Helper method for retrieving an Ask response with a simple card and reprompt included. * @param cardTitle Title of the card that you want displayed. * @param speechText speech text that will be spoken to the user. * @return the resulting card and speech text. */ private SpeechletResponse getAskResponse(String cardTitle, String speechText) { SimpleCard card = getSimpleCard(cardTitle, speechText); PlainTextOutputSpeech speech = getPlainTextOutputSpeech(speechText); Reprompt reprompt = getReprompt(speech); return SpeechletResponse.newAskResponse(speech, reprompt, card); } }
/** * Helper method for retrieving an Ask response with a simple card and reprompt included. * @param cardTitle Title of the card that you want displayed. * @param speechText speech text that will be spoken to the user. * @return the resulting card and speech text. */ private SpeechletResponse getAskResponse(String cardTitle, String speechText) { SimpleCard card = getSimpleCard(cardTitle, speechText); PlainTextOutputSpeech speech = getPlainTextOutputSpeech(speechText); Reprompt reprompt = getReprompt(speech); return SpeechletResponse.newAskResponse(speech, reprompt, card); } }
/** * Helper method for retrieving an Ask response with a simple card and reprompt included. * @param cardTitle Title of the card that you want displayed. * @param speechText speech text that will be spoken to the user. * @return the resulting card and speech text. */ private SpeechletResponse getAskResponse(String cardTitle, String speechText) { SimpleCard card = getSimpleCard(cardTitle, speechText); PlainTextOutputSpeech speech = getPlainTextOutputSpeech(speechText); Reprompt reprompt = getReprompt(speech); return SpeechletResponse.newAskResponse(speech, reprompt, card); } }
/** * Helper method for retrieving an Ask response with a simple card and reprompt included. * @param cardTitle Title of the card that you want displayed. * @param speechText speech text that will be spoken to the user. * @return the resulting card and speech text. */ private SpeechletResponse getAskResponse(String cardTitle, String speechText) { SimpleCard card = getSimpleCard(cardTitle, speechText); PlainTextOutputSpeech speech = getPlainTextOutputSpeech(speechText); Reprompt reprompt = getReprompt(speech); return SpeechletResponse.newAskResponse(speech, reprompt, card); } }
/** * Helper method for retrieving an Ask response with a simple card and reprompt included. * @param cardTitle Title of the card that you want displayed. * @param speechText speech text that will be spoken to the user. * @return the resulting card and speech text. */ private SpeechletResponse getAskResponse(String cardTitle, String speechText) { SimpleCard card = getSimpleCard(cardTitle, speechText); PlainTextOutputSpeech speech = getPlainTextOutputSpeech(speechText); Reprompt reprompt = getReprompt(speech); return SpeechletResponse.newAskResponse(speech, reprompt, card); } }
/** * Have Alexa ask something, and reprompt if there was no answer. * * @param askOutput The initial question without speak tags. * @param repromptOutput The reprompt statement without speak tags. * @return SpeechletResponse */ public static SpeechletResponse ask(String askOutput, String repromptOutput, Session session) { SsmlOutputSpeech outputSpeech = new SsmlOutputSpeech(); outputSpeech.setSsml("<speak>" + askOutput + "</speak>"); SsmlOutputSpeech repromptOutputSpeech = new SsmlOutputSpeech(); repromptOutputSpeech.setSsml("<speak>" + repromptOutput + "</speak>"); Reprompt reprompt = new Reprompt(); reprompt.setOutputSpeech(repromptOutputSpeech); return SpeechletResponse.newAskResponse(outputSpeech, reprompt); }
/** * Wrapper for creating the Ask response. The OutputSpeech and {@link Reprompt} objects are * created from the input strings. * * @param stringOutput * the output to be spoken * @param repromptText * the reprompt for if the user doesn't reply or is misunderstood. * @return SpeechletResponse the speechlet response */ private SpeechletResponse newAskResponse(String stringOutput, String repromptText) { PlainTextOutputSpeech outputSpeech = new PlainTextOutputSpeech(); outputSpeech.setText(stringOutput); PlainTextOutputSpeech repromptOutputSpeech = new PlainTextOutputSpeech(); repromptOutputSpeech.setText(repromptText); Reprompt reprompt = new Reprompt(); reprompt.setOutputSpeech(repromptOutputSpeech); return SpeechletResponse.newAskResponse(outputSpeech, reprompt); } }
/** * Wrapper for creating the Ask response. The OutputSpeech and {@link Reprompt} objects are * created from the input strings. * * @param stringOutput * the output to be spoken * @param repromptText * the reprompt for if the user doesn't reply or is misunderstood. * @return SpeechletResponse the speechlet response */ private SpeechletResponse newAskResponse(String stringOutput, String repromptText) { PlainTextOutputSpeech outputSpeech = new PlainTextOutputSpeech(); outputSpeech.setText(stringOutput); PlainTextOutputSpeech repromptOutputSpeech = new PlainTextOutputSpeech(); repromptOutputSpeech.setText(repromptText); Reprompt reprompt = new Reprompt(); reprompt.setOutputSpeech(repromptOutputSpeech); return SpeechletResponse.newAskResponse(outputSpeech, reprompt); } }
/** * Returns an ask Speechlet response for a speech and reprompt text. * * @param speechText * Text for speech output * @param repromptText * Text for reprompt output * @return ask Speechlet response for a speech and reprompt text */ private SpeechletResponse getAskSpeechletResponse(String speechText, String repromptText) { // Create the Simple card content. SimpleCard card = new SimpleCard(); card.setTitle("Session"); card.setContent(speechText); // Create the plain text output. PlainTextOutputSpeech speech = new PlainTextOutputSpeech(); speech.setText(speechText); // Create reprompt PlainTextOutputSpeech repromptSpeech = new PlainTextOutputSpeech(); repromptSpeech.setText(repromptText); Reprompt reprompt = new Reprompt(); reprompt.setOutputSpeech(repromptSpeech); return SpeechletResponse.newAskResponse(speech, reprompt, card); }
/** * Returns an ask Speechlet response for a speech and reprompt text. * * @param speechText * Text for speech output * @param repromptText * Text for reprompt output * @return ask Speechlet response for a speech and reprompt text */ private SpeechletResponse getAskSpeechletResponse(String speechText, String repromptText) { // Create the Simple card content. SimpleCard card = new SimpleCard(); card.setTitle("Session"); card.setContent(speechText); // Create the plain text output. PlainTextOutputSpeech speech = new PlainTextOutputSpeech(); speech.setText(speechText); // Create reprompt PlainTextOutputSpeech repromptSpeech = new PlainTextOutputSpeech(); repromptSpeech.setText(repromptText); Reprompt reprompt = new Reprompt(); reprompt.setOutputSpeech(repromptSpeech); return SpeechletResponse.newAskResponse(speech, reprompt, card); }
/** * Returns a Speechlet response for a speech and reprompt text. */ private SpeechletResponse getSpeechletResponse(String speechText, String repromptText, boolean isAskResponse) { // Create the Simple card content. SimpleCard card = new SimpleCard(); card.setTitle("Session"); card.setContent(speechText); // Create the plain text output. PlainTextOutputSpeech speech = new PlainTextOutputSpeech(); speech.setText(speechText); if (isAskResponse) { // Create reprompt PlainTextOutputSpeech repromptSpeech = new PlainTextOutputSpeech(); repromptSpeech.setText(repromptText); Reprompt reprompt = new Reprompt(); reprompt.setOutputSpeech(repromptSpeech); return SpeechletResponse.newAskResponse(speech, reprompt, card); } else { return SpeechletResponse.newTellResponse(speech, card); } } }
/** * Returns a Speechlet response for a speech and reprompt text. */ private SpeechletResponse getSpeechletResponse(String speechText, String repromptText, boolean isAskResponse) { // Create the Simple card content. SimpleCard card = new SimpleCard(); card.setTitle("Session"); card.setContent(speechText); // Create the plain text output. PlainTextOutputSpeech speech = new PlainTextOutputSpeech(); speech.setText(speechText); if (isAskResponse) { // Create reprompt PlainTextOutputSpeech repromptSpeech = new PlainTextOutputSpeech(); repromptSpeech.setText(repromptText); Reprompt reprompt = new Reprompt(); reprompt.setOutputSpeech(repromptSpeech); return SpeechletResponse.newAskResponse(speech, reprompt, card); } else { return SpeechletResponse.newTellResponse(speech, card); } } }
return SpeechletResponse.newAskResponse(outputSpeech, repromptSpeech, card);
return SpeechletResponse.newAskResponse(outputSpeech, reprompt);
return SpeechletResponse.newAskResponse(outputSpeech, reprompt);
return SpeechletResponse.newAskResponse(outputSpeech, reprompt);
return SpeechletResponse.newAskResponse(outputSpeech, reprompt);
return SpeechletResponse.newAskResponse(outputSpeech, reprompt);
return SpeechletResponse.newAskResponse(outputSpeech, reprompt);
return SpeechletResponse.newAskResponse(outputSpeech, reprompt);