本文整理汇总了Java中com.amazon.speech.slu.Slot类的典型用法代码示例。如果您正苦于以下问题:Java Slot类的具体用法?Java Slot怎么用?Java Slot使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Slot类属于com.amazon.speech.slu包,在下文中一共展示了Slot类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getAddressFromSlot
import com.amazon.speech.slu.Slot; //导入依赖的package包/类
public static String getAddressFromSlot(Slot postalAddress, Slot city, Slot landmark) {
String landmarkValue = getSafeValue(landmark);
if (!TextUtils.isEmpty(landmarkValue)) {
return landmarkValue;
}
String addressValue = getSafeValue(postalAddress);
String cityValue = getSafeValue(city);
if (!TextUtils.isEmpty(addressValue) && !TextUtils.isEmpty(cityValue)) {
return String.format(Locale.US, "%s, %s", addressValue, cityValue);
} else if (!TextUtils.isEmpty(addressValue)) {
return addressValue;
} else {
return cityValue;
}
}
开发者ID:mapbox,项目名称:mapbox-assistant-example,代码行数:17,代码来源:AddressUtils.java
示例2: setDevice
import com.amazon.speech.slu.Slot; //导入依赖的package包/类
private SpeechletResponse setDevice(final Intent intent, boolean enable) {
Slot deviceSlot = intent.getSlot(DEVICE_SLOT);
if (deviceSlot == null || deviceSlot.getValue() == null) {
return newResponse("Gerät nicht erkannt");
}
try {
Optional<SwitchDevice> dev = findDevice(deviceSlot.getValue());
if (!dev.isPresent()) {
return newResponse(String.format("Das Gerät %s ist mir nicht bekannt", deviceSlot.getValue()));
}
SwitchDevice device = dev.get();
if (!device.isSwitch()) {
return newResponse(String.format("%s %s ist kein Schaltgerät", toGroupName(device), deviceSlot.getValue()));
}
if (!device.isPresent()) {
return newResponse(String.format("%s %s ist nicht verbunden", toGroupName(device), deviceSlot.getValue()));
}
service.setDeviceState(device, enable);
boolean succeed = device.getState() == (enable ? State.ON : State.OFF);
return newResponse("Fritz Home Switch", succeed ? "Ok" : String.format("Das Gerät %s konnte nicht geschaltet werden", deviceSlot.getValue()));
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return newResponse("Es ist ein Fehler beim Schalten des Gerätes aufgetreten");
}
开发者ID:comtel2000,项目名称:fritz-home-skill,代码行数:27,代码来源:FritzHomeSpeechlet.java
示例3: getDeviceTemp
import com.amazon.speech.slu.Slot; //导入依赖的package包/类
private SpeechletResponse getDeviceTemp(final Intent intent, final Locale locale) {
Slot deviceSlot = intent.getSlot(DEVICE_SLOT);
if (deviceSlot == null || deviceSlot.getValue() == null) {
return newResponse("Gerät nicht erkannt");
}
try {
Optional<SwitchDevice> dev = findDevice(deviceSlot.getValue());
if (!dev.isPresent()) {
return newResponse(String.format("Das Gerät %s ist mir nicht bekannt", deviceSlot.getValue()));
}
SwitchDevice device = dev.get();
if (!device.isPresent()) {
return newResponse(String.format("%s %s ist aktuell nicht verfügbar", toGroupName(device), deviceSlot.getValue()));
}
if (!device.isTemperature()) {
return newResponse(String.format("%s %s hat keinen Temperatursensor", toGroupName(device), deviceSlot.getValue()));
}
return newResponse("Fritz Home Temperatur",
String.format("Die Temperatur an Gerät %s beträgt %s", deviceSlot.getValue(), FritzUtils.getTemperature(locale, device.getTemperature())));
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return newResponse("Es ist ein Fehler beim Lesen der Gerätetemperatur aufgetreten");
}
开发者ID:comtel2000,项目名称:fritz-home-skill,代码行数:26,代码来源:FritzHomeSpeechlet.java
示例4: updateIntent
import com.amazon.speech.slu.Slot; //导入依赖的package包/类
private Intent updateIntent(Intent intent) {
Map<String, Slot> slots = new HashMap<>(intent.getSlots());
if(sv(intent, SLOT_DATE_TO) != null || sv(intent, SLOT_TIME_TO) != null) {
if(sv(intent, SLOT_DURATION) == null) {
Slot updatedSlot = Slot.builder()
.withName(SLOT_DURATION)
.withConfirmationStatus(ConfirmationStatus.NONE)
.withValue("<placeholder>")
.build();
slots.put(SLOT_DURATION, updatedSlot);
}
}
return Intent.builder()
.withName(intent.getName())
.withConfirmationStatus(intent.getConfirmationStatus())
.withSlots(slots)
.build();
}
开发者ID:rainu,项目名称:alexa-skill,代码行数:21,代码来源:NewEventSpeechlet.java
示例5: translate
import com.amazon.speech.slu.Slot; //导入依赖的package包/类
public String translate(final String testPhrase, final String language) {
final Map<String, Slot> slots = new HashMap<>();
slots.put("termA", Slot.builder().withName("termA").withValue(testPhrase).build());
slots.put("termB", Slot.builder().withName("termB").build());
slots.put("language", Slot.builder().withName("language").withValue(language).build());
final SpeechletRequestEnvelope envelope = givenIntentSpeechletRequestEnvelope("Translate", slots);
final ObjectMapper mapper = new ObjectMapper();
String response = null;
try {
final AWSLambdaClient awsLambda = new AWSLambdaClient();
final InvokeRequest invokeRequest = new InvokeRequest()
.withInvocationType(InvocationType.RequestResponse)
.withFunctionName(lambdaName)
.withPayload(mapper.writeValueAsString(envelope));
final InvokeResult invokeResult = awsLambda.invoke(invokeRequest);
response = new String(invokeResult.getPayload().array());
} catch (JsonProcessingException e) {
log.error(e.getMessage());
}
return response;
}
开发者ID:KayLerch,项目名称:alexa-meets-polly,代码行数:22,代码来源:SkillClient.java
示例6: newRefineEmptySlots
import com.amazon.speech.slu.Slot; //导入依赖的package包/类
private static Map<String, Slot> newRefineEmptySlots() {
Map<String, Slot> slots = new HashMap<>();
addSlotValue(slots, SlotUtil.REFINE_TYPE, null);
addSlotValue(slots, SlotUtil.COMPARISON_COLUMN_1, null);
addSlotValue(slots, SlotUtil.COMPARATOR_1, null);
addSlotValue(slots, SlotUtil.COLUMN_VALUE_1, null);
addSlotValue(slots, SlotUtil.COLUMN_NUMBER_1, null);
addSlotValue(slots, SlotUtil.BINARY_LOGIC_OP_1, null);
addSlotValue(slots, SlotUtil.COMPARISON_COLUMN_2, null);
addSlotValue(slots, SlotUtil.COMPARATOR_2, null);
addSlotValue(slots, SlotUtil.COLUMN_VALUE_2, null);
addSlotValue(slots, SlotUtil.COLUMN_NUMBER_2, null);
addSlotValue(slots, SlotUtil.BINARY_LOGIC_OP_2, null);
addSlotValue(slots, SlotUtil.COMPARISON_COLUMN_3, null);
addSlotValue(slots, SlotUtil.COMPARATOR_3, null);
addSlotValue(slots, SlotUtil.COLUMN_VALUE_3, null);
addSlotValue(slots, SlotUtil.COLUMN_NUMBER_3, null);
addSlotValue(slots, SlotUtil.GROUP_BY_COLUMN, null);
return slots;
}
开发者ID:vqtran,项目名称:EchoQuery,代码行数:21,代码来源:RefineHandlerTest.java
示例7: newSimpleSession
import com.amazon.speech.slu.Slot; //导入依赖的package包/类
private static Session newSimpleSession() {
Session session = Session.builder().withSessionId("1").build();
Map<String, Slot> slots = QueryHandlerTest.newEmptySlots();
addSlotValue(slots, SlotUtil.TABLE_NAME, "sales");
addSlotValue(slots, SlotUtil.FUNC, "how many");
QueryRequest request = QueryRequest.of(Intent.builder()
.withName("AggregationIntent").withSlots(slots).build());
try {
session.setAttribute(
SessionUtil.REQUEST_ATTRIBUTE, Serializer.serialize(request));
} catch (IOException e) {
e.printStackTrace();
}
return session;
}
开发者ID:vqtran,项目名称:EchoQuery,代码行数:17,代码来源:RefineHandlerTest.java
示例8: newWhereSession
import com.amazon.speech.slu.Slot; //导入依赖的package包/类
private static Session newWhereSession() {
Session session = Session.builder().withSessionId("1").build();
Map<String, Slot> slots = QueryHandlerTest.newEmptySlots();
addSlotValue(slots, SlotUtil.TABLE_NAME, "sales");
addSlotValue(slots, SlotUtil.FUNC, "how many");
addSlotValue(slots, SlotUtil.COMPARISON_COLUMN_1, "store");
addSlotValue(slots, SlotUtil.COMPARATOR_1, "is not");
addSlotValue(slots, SlotUtil.COLUMN_VALUE_1, "Warwick");
QueryRequest request = QueryRequest.of(Intent.builder()
.withName("AggregationIntent").withSlots(slots).build());
try {
session.setAttribute(
SessionUtil.REQUEST_ATTRIBUTE, Serializer.serialize(request));
} catch (IOException e) {
e.printStackTrace();
}
return session;
}
开发者ID:vqtran,项目名称:EchoQuery,代码行数:20,代码来源:RefineHandlerTest.java
示例9: newGroupedBySession
import com.amazon.speech.slu.Slot; //导入依赖的package包/类
private static Session newGroupedBySession() {
Session session = Session.builder().withSessionId("1").build();
Map<String, Slot> slots = QueryHandlerTest.newEmptySlots();
addSlotValue(slots, SlotUtil.TABLE_NAME, "sales");
addSlotValue(slots, SlotUtil.FUNC, "how many");
addSlotValue(slots, SlotUtil.GROUP_BY_COLUMN, "store");
QueryRequest request = QueryRequest.of(Intent.builder()
.withName("AggregationIntent").withSlots(slots).build());
try {
session.setAttribute(
SessionUtil.REQUEST_ATTRIBUTE, Serializer.serialize(request));
} catch (IOException e) {
e.printStackTrace();
}
return session;
}
开发者ID:vqtran,项目名称:EchoQuery,代码行数:18,代码来源:RefineHandlerTest.java
示例10: newEmptySlots
import com.amazon.speech.slu.Slot; //导入依赖的package包/类
public static Map<String, Slot> newEmptySlots() {
Map<String, Slot> slots = new HashMap<>();
addSlotValue(slots, SlotUtil.TABLE_NAME, null);
addSlotValue(slots, SlotUtil.FUNC, null);
addSlotValue(slots, SlotUtil.AGGREGATION_COLUMN, null);
addSlotValue(slots, SlotUtil.COMPARISON_COLUMN_1, null);
addSlotValue(slots, SlotUtil.COMPARATOR_1, null);
addSlotValue(slots, SlotUtil.COLUMN_VALUE_1, null);
addSlotValue(slots, SlotUtil.COLUMN_NUMBER_1, null);
addSlotValue(slots, SlotUtil.BINARY_LOGIC_OP_1, null);
addSlotValue(slots, SlotUtil.COMPARISON_COLUMN_2, null);
addSlotValue(slots, SlotUtil.COMPARATOR_2, null);
addSlotValue(slots, SlotUtil.COLUMN_VALUE_2, null);
addSlotValue(slots, SlotUtil.COLUMN_NUMBER_2, null);
addSlotValue(slots, SlotUtil.BINARY_LOGIC_OP_2, null);
addSlotValue(slots, SlotUtil.COMPARISON_COLUMN_3, null);
addSlotValue(slots, SlotUtil.COMPARATOR_3, null);
addSlotValue(slots, SlotUtil.COLUMN_VALUE_3, null);
addSlotValue(slots, SlotUtil.COLUMN_NUMBER_3, null);
addSlotValue(slots, SlotUtil.GROUP_BY_COLUMN, null);
return slots;
}
开发者ID:vqtran,项目名称:EchoQuery,代码行数:23,代码来源:QueryHandlerTest.java
示例11: testWithTwoWhereClauses
import com.amazon.speech.slu.Slot; //导入依赖的package包/类
@Test
public void testWithTwoWhereClauses() {
Map<String, Slot> slots = newEmptySlots();
addSlotValue(slots, SlotUtil.TABLE_NAME, "sales");
addSlotValue(slots, SlotUtil.FUNC, "how many");
addSlotValue(slots, SlotUtil.COMPARISON_COLUMN_1, "product");
addSlotValue(slots, SlotUtil.COMPARATOR_1, "is");
addSlotValue(slots, SlotUtil.COLUMN_VALUE_1, "speakers");
addSlotValue(slots, SlotUtil.BINARY_LOGIC_OP_1, "and");
addSlotValue(slots, SlotUtil.COMPARISON_COLUMN_2, "store");
addSlotValue(slots, SlotUtil.COMPARATOR_2, "is not");
addSlotValue(slots, SlotUtil.COLUMN_VALUE_2, "warwick");
assertResponse(slots, "There is one row in the sales table"
+ " where product is equal to speakers and store is not equal "
+ "to warwick.");
}
开发者ID:vqtran,项目名称:EchoQuery,代码行数:17,代码来源:QueryHandlerTest.java
示例12: testWithThreeWhereClauses
import com.amazon.speech.slu.Slot; //导入依赖的package包/类
@Test
public void testWithThreeWhereClauses() {
Map<String, Slot> slots = newEmptySlots();
addSlotValue(slots, SlotUtil.TABLE_NAME, "sales");
addSlotValue(slots, SlotUtil.FUNC, "how many");
addSlotValue(slots, SlotUtil.COMPARISON_COLUMN_1, "product");
addSlotValue(slots, SlotUtil.COMPARATOR_1, "is");
addSlotValue(slots, SlotUtil.COLUMN_VALUE_1, "speakers");
addSlotValue(slots, SlotUtil.BINARY_LOGIC_OP_1, "and");
addSlotValue(slots, SlotUtil.COMPARISON_COLUMN_2, "store");
addSlotValue(slots, SlotUtil.COMPARATOR_2, "is not");
addSlotValue(slots, SlotUtil.COLUMN_VALUE_2, "warwick");
addSlotValue(slots, SlotUtil.BINARY_LOGIC_OP_2, "and");
addSlotValue(slots, SlotUtil.COMPARISON_COLUMN_3, "count");
addSlotValue(slots, SlotUtil.COMPARATOR_3, "greater than");
addSlotValue(slots, SlotUtil.COLUMN_NUMBER_3, "5");
assertResponse(slots, "There are zero rows in the sales table"
+ " where product is equal to speakers and store is not equal to"
+ " warwick and count is greater than five.");
}
开发者ID:vqtran,项目名称:EchoQuery,代码行数:21,代码来源:QueryHandlerTest.java
示例13: testWithThreeWhereClausesWithOrderOfOperations
import com.amazon.speech.slu.Slot; //导入依赖的package包/类
@Test
public void testWithThreeWhereClausesWithOrderOfOperations() {
Map<String, Slot> slots = newEmptySlots();
addSlotValue(slots, SlotUtil.TABLE_NAME, "sales");
addSlotValue(slots, SlotUtil.FUNC, "average");
addSlotValue(slots, SlotUtil.AGGREGATION_COLUMN, "count");
addSlotValue(slots, SlotUtil.COMPARISON_COLUMN_1, "product");
addSlotValue(slots, SlotUtil.COMPARATOR_1, "is");
addSlotValue(slots, SlotUtil.COLUMN_VALUE_1, "speakers");
addSlotValue(slots, SlotUtil.BINARY_LOGIC_OP_1, "or");
addSlotValue(slots, SlotUtil.COMPARISON_COLUMN_2, "store");
addSlotValue(slots, SlotUtil.COMPARATOR_2, "is equal to");
addSlotValue(slots, SlotUtil.COLUMN_VALUE_2, "pawtucket");
addSlotValue(slots, SlotUtil.BINARY_LOGIC_OP_2, "and");
addSlotValue(slots, SlotUtil.COMPARISON_COLUMN_3, "product");
addSlotValue(slots, SlotUtil.COMPARATOR_3, "is equal to");
addSlotValue(slots, SlotUtil.COLUMN_VALUE_3, "camera");
assertResponse(slots, "The average of the count column in the sales table"
+ " where product is equal to speakers or store is equal to pawtucket "
+ "and product is equal to camera is two point three three.");
}
开发者ID:vqtran,项目名称:EchoQuery,代码行数:22,代码来源:QueryHandlerTest.java
示例14: testRequiringJoinForSecondComparisonColumn
import com.amazon.speech.slu.Slot; //导入依赖的package包/类
@Test
public void testRequiringJoinForSecondComparisonColumn() {
Map<String, Slot> slots = newEmptySlots();
addSlotValue(slots, SlotUtil.TABLE_NAME, "employees");
addSlotValue(slots, SlotUtil.FUNC, "count");
addSlotValue(slots, SlotUtil.COMPARISON_COLUMN_1, "name");
addSlotValue(slots, SlotUtil.COMPARATOR_1, "is not");
addSlotValue(slots, SlotUtil.COLUMN_VALUE_1, "vinh");
addSlotValue(slots, SlotUtil.BINARY_LOGIC_OP_1, "and");
addSlotValue(slots, SlotUtil.COMPARISON_COLUMN_2, "title");
addSlotValue(slots, SlotUtil.COMPARATOR_2, "is not");
addSlotValue(slots, SlotUtil.COLUMN_VALUE_2, "professor");
assertResponse(slots, "There is one row in the employees table where "
+ "employee name is not equal to vinh and title is not equal to "
+ "professor.");
}
开发者ID:vqtran,项目名称:EchoQuery,代码行数:17,代码来源:QueryHandlerTest.java
示例15: testRequiringJoinForThirdComparisonColumn
import com.amazon.speech.slu.Slot; //导入依赖的package包/类
@Test
public void testRequiringJoinForThirdComparisonColumn() {
Map<String, Slot> slots = newEmptySlots();
addSlotValue(slots, SlotUtil.TABLE_NAME, "employees");
addSlotValue(slots, SlotUtil.FUNC, "count");
addSlotValue(slots, SlotUtil.COMPARISON_COLUMN_1, "name");
addSlotValue(slots, SlotUtil.COMPARATOR_1, "is not");
addSlotValue(slots, SlotUtil.COLUMN_VALUE_1, "vinh");
addSlotValue(slots, SlotUtil.BINARY_LOGIC_OP_1, "and");
addSlotValue(slots, SlotUtil.COMPARISON_COLUMN_2, "title");
addSlotValue(slots, SlotUtil.COMPARATOR_2, "is");
addSlotValue(slots, SlotUtil.COLUMN_VALUE_2, "professor");
addSlotValue(slots, SlotUtil.BINARY_LOGIC_OP_2, "and");
addSlotValue(slots, SlotUtil.COMPARISON_COLUMN_3, "salary");
addSlotValue(slots, SlotUtil.COMPARATOR_3, "is greater than");
addSlotValue(slots, SlotUtil.COLUMN_NUMBER_3, "100");
assertResponse(slots, "There is one row in the employees table where "
+ "employee name is not equal to vinh and title is equal to professor "
+ "and salary is greater than one hundred.");
}
开发者ID:vqtran,项目名称:EchoQuery,代码行数:21,代码来源:QueryHandlerTest.java
示例16: newEmptySlots
import com.amazon.speech.slu.Slot; //导入依赖的package包/类
private Map<String, Slot> newEmptySlots() {
Map<String, Slot> slots = new HashMap<>();
addSlotValue(slots, SlotUtil.TABLE_NAME, null);
addSlotValue(slots, SlotUtil.FUNC, null);
addSlotValue(slots, SlotUtil.AGGREGATION_COLUMN, null);
addSlotValue(slots, SlotUtil.COMPARISON_COLUMN_1, null);
addSlotValue(slots, SlotUtil.COMPARATOR_1, null);
addSlotValue(slots, SlotUtil.COLUMN_VALUE_1, null);
addSlotValue(slots, SlotUtil.COLUMN_NUMBER_1, null);
addSlotValue(slots, SlotUtil.BINARY_LOGIC_OP_1, null);
addSlotValue(slots, SlotUtil.COMPARISON_COLUMN_2, null);
addSlotValue(slots, SlotUtil.COMPARATOR_2, null);
addSlotValue(slots, SlotUtil.COLUMN_VALUE_2, null);
addSlotValue(slots, SlotUtil.COLUMN_NUMBER_2, null);
addSlotValue(slots, SlotUtil.BINARY_LOGIC_OP_2, null);
addSlotValue(slots, SlotUtil.COMPARISON_COLUMN_3, null);
addSlotValue(slots, SlotUtil.COMPARATOR_3, null);
addSlotValue(slots, SlotUtil.COLUMN_VALUE_3, null);
addSlotValue(slots, SlotUtil.COLUMN_NUMBER_3, null);
addSlotValue(slots, SlotUtil.GROUP_BY_COLUMN, null);
return slots;
}
开发者ID:vqtran,项目名称:EchoQuery,代码行数:23,代码来源:SerializationTest.java
示例17: test
import com.amazon.speech.slu.Slot; //导入依赖的package包/类
@Test
public void test() {
Map<String, Slot> slots = newEmptySlots();
addSlotValue(slots, SlotUtil.TABLE_NAME, "employees");
addSlotValue(slots, SlotUtil.FUNC, "average");
addSlotValue(slots, SlotUtil.AGGREGATION_COLUMN, "salary");
addSlotValue(slots, SlotUtil.COMPARISON_COLUMN_1, "name");
addSlotValue(slots, SlotUtil.COMPARATOR_1, "is not");
addSlotValue(slots, SlotUtil.COLUMN_VALUE_1, "vinh");
QueryRequest req = QueryRequest.of(Intent.builder()
.withName("AggregationIntent")
.withSlots(slots).build());
try {
QueryRequest res =
(QueryRequest) Serializer.deserialize(Serializer.serialize(req));
assertEquals(req, res);
} catch (ClassNotFoundException | IOException e) {
e.printStackTrace();
}
}
开发者ID:vqtran,项目名称:EchoQuery,代码行数:21,代码来源:SerializationTest.java
示例18: getSafeValue
import com.amazon.speech.slu.Slot; //导入依赖的package包/类
private static String getSafeValue(Slot slot) {
try {
return slot.getValue();
} catch (Exception e) {
return null;
}
}
开发者ID:mapbox,项目名称:mapbox-assistant-example,代码行数:8,代码来源:AddressUtils.java
示例19: getHomeAddressResponse
import com.amazon.speech.slu.Slot; //导入依赖的package包/类
public SpeechletResponse getHomeAddressResponse(Slot postalAddress, Slot city) {
String speechText;
String cardText;
Image image = null;
String address = AddressUtils.getAddressFromSlot(postalAddress, city, null);
try {
Position position = AddressUtils.getCoordinatesFromAddress(address, null);
storageManager.setHomeAddress(position);
speechText = "Thank you, home address set.";
cardText = String.format(Locale.US, "Thank you, home address set: %s", address);
image = new Image();
image.setSmallImageUrl(ImageComponent.getLocationMap(position, true));
image.setLargeImageUrl(ImageComponent.getLocationMap(position, false));
} catch (Exception e) {
speechText = "Sorry, I couldn't find that address.";
cardText = String.format(Locale.US, "Sorry, I couldn't find that address: %s", address);
}
// Create a standard card content
StandardCard card = new StandardCard();
card.setTitle(CARD_TITLE);
card.setText(cardText);
// Card image
if (image != null) {
card.setImage(image);
}
// Create the plain text output
PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
speech.setText(speechText);
return SpeechletResponse.newTellResponse(speech, card);
}
开发者ID:mapbox,项目名称:mapbox-assistant-example,代码行数:37,代码来源:IntentManager.java
示例20: getOfficeAddressResponse
import com.amazon.speech.slu.Slot; //导入依赖的package包/类
public SpeechletResponse getOfficeAddressResponse(Slot postalAddress, Slot city) {
String speechText;
String cardText;
Image image = null;
String address = AddressUtils.getAddressFromSlot(postalAddress, city, null);
try {
Position proximity = storageManager.getHomeAddress();
Position position = AddressUtils.getCoordinatesFromAddress(address, proximity);
storageManager.setOfficeAddress(position);
cardText = String.format(Locale.US, "Thank you, office address set: %s", address);
speechText = "Thank you, office address set.";
image = new Image();
image.setSmallImageUrl(ImageComponent.getLocationMap(position, true));
image.setLargeImageUrl(ImageComponent.getLocationMap(position, false));
} catch (Exception e) {
cardText = String.format(Locale.US, "Sorry, I couldn't find that address: %s", address);
speechText = "Sorry, I couldn't find that address.";
}
// Create a standard card content
StandardCard card = new StandardCard();
card.setTitle(CARD_TITLE);
card.setText(cardText);
// Card image
if (image != null) {
card.setImage(image);
}
// Create the plain text output
PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
speech.setText(speechText);
return SpeechletResponse.newTellResponse(speech, card);
}
开发者ID:mapbox,项目名称:mapbox-assistant-example,代码行数:38,代码来源:IntentManager.java
注:本文中的com.amazon.speech.slu.Slot类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论