本文整理汇总了Java中com.amazon.speech.ui.Reprompt类的典型用法代码示例。如果您正苦于以下问题:Java Reprompt类的具体用法?Java Reprompt怎么用?Java Reprompt使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Reprompt类属于com.amazon.speech.ui包,在下文中一共展示了Reprompt类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getWelcomeResponse
import com.amazon.speech.ui.Reprompt; //导入依赖的package包/类
/**
* Creates and returns a {@code SpeechletResponse} with a welcome message.
*
* @return SpeechletResponse spoken and visual response for the given intent
*/
private SpeechletResponse getWelcomeResponse() {
String speechText = "Welcome to the Alexa Skills Kit, you can say hello";
// Create the Simple card content.
SimpleCard card = new SimpleCard();
card.setTitle("HelloWorld");
card.setContent(speechText);
// Create the plain text output.
PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
speech.setText(speechText);
// Create reprompt
Reprompt reprompt = new Reprompt();
reprompt.setOutputSpeech(speech);
return SpeechletResponse.newAskResponse(speech, reprompt, card);
}
示例2: getHelpResponse
import com.amazon.speech.ui.Reprompt; //导入依赖的package包/类
/**
* Creates a {@code SpeechletResponse} for the help intent.
*
* @return SpeechletResponse spoken and visual response for the given intent
*/
private SpeechletResponse getHelpResponse() {
String speechText = "You can say hello to me!";
// Create the Simple card content.
SimpleCard card = new SimpleCard();
card.setTitle("HelloWorld");
card.setContent(speechText);
// Create the plain text output.
PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
speech.setText(speechText);
// Create reprompt
Reprompt reprompt = new Reprompt();
reprompt.setOutputSpeech(speech);
return SpeechletResponse.newAskResponse(speech, reprompt, card);
}
示例3: getWelcomeResponse
import com.amazon.speech.ui.Reprompt; //导入依赖的package包/类
/**
* Creates and returns a {@code SpeechletResponse} with a welcome message.
*
* @return SpeechletResponse spoken and visual response for the given intent
*/
@OnLaunch
public SpeechletResponse getWelcomeResponse() {
String speechText = "Welcome to the Alexa Skills Kit, you can say hello";
// Create the Simple card content.
SimpleCard card = new SimpleCard();
card.setTitle("HelloWorld");
card.setContent(speechText);
// Create the plain text output.
PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
speech.setText(speechText);
// Create reprompt
Reprompt reprompt = new Reprompt();
reprompt.setOutputSpeech(speech);
return SpeechletResponse.newAskResponse(speech, reprompt, card);
}
示例4: getHelpResponse
import com.amazon.speech.ui.Reprompt; //导入依赖的package包/类
/**
* Creates a {@code SpeechletResponse} for the help intent.
*
* @return SpeechletResponse spoken and visual response for the given intent
*/
@OnIntent({ "AMAZON.HelpIntent", "AMAZON.StopIntent", "AMAZON.CancelIntent" })
public SpeechletResponse getHelpResponse() {
String speechText = "You can say hello to me!";
// Create the Simple card content.
SimpleCard card = new SimpleCard();
card.setTitle("HelloWorld");
card.setContent(speechText);
// Create the plain text output.
PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
speech.setText(speechText);
// Create reprompt
Reprompt reprompt = new Reprompt();
reprompt.setOutputSpeech(speech);
return SpeechletResponse.newAskResponse(speech, reprompt, card);
}
示例5: getReprompt
import com.amazon.speech.ui.Reprompt; //导入依赖的package包/类
/**
* Gets the generated reprompt.
* @return the generated reprompt
*/
@Override
public Reprompt getReprompt() {
if (reprompt != null || !output.shouldReprompt()) {
return reprompt;
}
final String repromptSpeech = yamlReader.getRandomReprompt(output).orElse(null);
if (repromptSpeech != null) {
final String utteranceSsml = resolveSlotsInUtterance(repromptSpeech);
final SsmlOutputSpeech ssmlOutputSpeech = new SsmlOutputSpeech();
ssmlOutputSpeech.setSsml(utteranceSsml);
final Reprompt reprompt2 = new Reprompt();
reprompt2.setOutputSpeech(ssmlOutputSpeech);
return reprompt2;
}
return null;
}
示例6: onLaunch
import com.amazon.speech.ui.Reprompt; //导入依赖的package包/类
@Override
public SpeechletResponse onLaunch(LaunchRequest request, Session session) throws SpeechletException {
String speechText = "Hello world, this is Snoolexa! Try asking for hot posts!";
//TODO: Query the me endpoint and tell asker about currently signed in redditor and any notifications
// Create the Simple card content.
SimpleCard card = new SimpleCard();
card.setTitle("Snoolexa");
card.setContent(speechText);
// Create the plain text output.
PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
speech.setText(speechText);
// Create reprompt
Reprompt reprompt = new Reprompt();
reprompt.setOutputSpeech(speech);
return SpeechletResponse.newAskResponse(speech, reprompt, card);
}
示例7: getWelcomeResponse
import com.amazon.speech.ui.Reprompt; //导入依赖的package包/类
/**
* Creates and returns a {@code SpeechletResponse} with a welcome message.
*
* @return SpeechletResponse spoken and visual response for the given intent
*/
private SpeechletResponse getWelcomeResponse() {
String speechText = "This is Sky, how can I help you";
// create the Simple card content
SimpleCard card = new SimpleCard();
card.setTitle("Sky");
card.setContent(speechText);
// create the plain text output
PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
speech.setText(speechText);
// create reprompt
Reprompt reprompt = new Reprompt();
reprompt.setOutputSpeech(speech);
return SpeechletResponse.newAskResponse(speech, reprompt, card);
}
示例8: getHelpResponse
import com.amazon.speech.ui.Reprompt; //导入依赖的package包/类
/**
* Creates a {@code SpeechletResponse} for the help intent.
*
* @return SpeechletResponse spoken and visual response for the given intent
*/
private SpeechletResponse getHelpResponse() {
String speechText = "I am not a very helpful skill I'm afraid!";
// Create the Simple card content.
SimpleCard card = new SimpleCard();
card.setTitle("Sky");
card.setContent(speechText);
// Create the plain text output.
PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
speech.setText(speechText);
// Create reprompt
Reprompt reprompt = new Reprompt();
reprompt.setOutputSpeech(speech);
return SpeechletResponse.newAskResponse(speech, reprompt, card);
}
示例9: getWelcomeResponse
import com.amazon.speech.ui.Reprompt; //导入依赖的package包/类
/**
* Creates and returns a {@code SpeechletResponse} with a welcome message.
*
* @return SpeechletResponse spoken and visual response for the given intent
*/
@OnLaunch
public SpeechletResponse getWelcomeResponse(final LaunchRequest request) {
final OutputSpeech speech = speechService.speechWelcomeMessage(request.getLocale());
return SpeechletResponse.newAskResponse(speech, new Reprompt());
}
示例10: getEpisode
import com.amazon.speech.ui.Reprompt; //导入依赖的package包/类
private SpeechletResponse getEpisode(String show) {
log.info("Received request for show '" + show + "'");
PlainTextOutputSpeech mySpeech = new PlainTextOutputSpeech();
Random randy = new Random();
if (showHash.containsKey(show)) {
int season = randy.nextInt(showHash.get(show).length);
int episode = randy.nextInt(showHash.get(show)[season]) + 1;
log.info("Randomly generated season " + season + " and episode " + episode);
mySpeech.setText("Watch " + show + " season " + (season + 1) + " episode " + episode);
return SpeechletResponse.newTellResponse(mySpeech);
} else if ("any show".equals(show)) {
String tv_show = listOfShows[randy.nextInt(listOfShows.length)];
return getEpisode(tv_show);
}
else if (show.isEmpty()){
mySpeech.setText("Which show?");
PlainTextOutputSpeech repromptSpeech = new PlainTextOutputSpeech();
repromptSpeech.setText("Which show? Choose between " + String.join(", ", Arrays.copyOfRange(listOfShows, 0, listOfShows.length-1)) + " and " + listOfShows[listOfShows.length-1]);
Reprompt reprompt = new Reprompt();
reprompt.setOutputSpeech(repromptSpeech);
return SpeechletResponse.newAskResponse(mySpeech, reprompt);
}
else {
mySpeech.setText("I don't know about that show");
return SpeechletResponse.newTellResponse(mySpeech);
}
}
示例11: getRepromptSpeech
import com.amazon.speech.ui.Reprompt; //导入依赖的package包/类
public Reprompt getRepromptSpeech() {
SsmlOutputSpeech outputSpeech = new SsmlOutputSpeech();
outputSpeech.setSsml("<speak>If you are lost, just ask me to help.</speak>");
Reprompt reprompt = new Reprompt();
reprompt.setOutputSpeech(outputSpeech);
return reprompt;
}
示例12: newAskResponse
import com.amazon.speech.ui.Reprompt; //导入依赖的package包/类
/**
* 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);
}
示例13: createWelcomeResponse
import com.amazon.speech.ui.Reprompt; //导入依赖的package包/类
protected SpeechletResponse createWelcomeResponse() {
// TODO, register these
PlainTextOutputSpeech outputSpeech = new PlainTextOutputSpeech();
outputSpeech.setText("You can tell me someone took medicine or record the time");
Reprompt reprompt = new Reprompt();
reprompt.setOutputSpeech(SpeechletUtils.createTextOutputSpeech("What should I note?"));
return SpeechletResponse.newAskResponse(outputSpeech, reprompt);
}
示例14: ask
import com.amazon.speech.ui.Reprompt; //导入依赖的package包/类
/**
* 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);
}
示例15: withOutputSpeech
import com.amazon.speech.ui.Reprompt; //导入依赖的package包/类
public static Reprompt withOutputSpeech(OutputSpeech speech){
Reprompt result = new Reprompt();
result.setOutputSpeech(speech);
return result;
}