我可以将Amazon LEX与Google助手一起使用吗?

编程入门 行业动态 更新时间:2024-10-26 18:16:17
本文介绍了我可以将Amazon LEX与Google助手一起使用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我已经使用Amazon的 LEX .

I have made a Chat-Bot using Amazon's LEX.

我可以通过手机中的Google 语音助手使用该应用程序吗? ?

Is there any way I can use that application using Google's Voice Assistant in my phone?

如果不是为什么?

推荐答案

是的,可以将Google的语音助手应用程序与Amazon Lex一起用作NLP引擎.

Yes it is possible to use Google's voice assistant application with Amazon Lex as NLP engine.

  • 转到 developers.google/actions/并登录
  • 使用左上角的按钮转到操作控制台
  • 创建一个Amaaon Lex代理
  • 在操作的SDK中,使用 Lex的运行时库 postContent或postText函数调用Lex并获取意图名称
  • 在Actions SDK中创建函数以返回履行文本
  • Go to developers.google/actions/ and log in
  • Go to Actions Console using button on top left corner
  • Create an Amaaon Lex agent
  • In your actions's SDK use Lex's runtime library to postContent or postText function to call Lex and get intent name
  • Make your functions in Actions SDK to return fulfillment text

Nodejs中的伪代码:

Pseudo Code in Nodejs :

const {actionssdk} = require('actions-on-google'); const express = require('express'); const bodyParser = require('body-parser'); const rp = require('request-promise'); const app = actionssdk({debug: true}); app.intent('actions.intent.MAIN', (conv) => { conv.ask('Hi!'); }); app.intent('actions.intent.TEXT', (conv, input) => { // here you will write code to call amazon lex and pass input text intent_name = lex_library(input) return rp({ intent_name }) .then((res) => { // create an intent-action mapper const actionMap = { name: nameIntent, help: helpIntent, }; // check the intent name from Lex if (res.intent_name && res.intent_name !== 'None') { // Map intents to functions for different responses actionMap[res['intent_name']](conv); } else { conv.ask('Sorry, I don\'t understand what you mean.'); } }) .catch((e) => { console.log('Error =>', e); }); }); function nameIntent(conv) { conv.ask('My name is noobie. Hope you are fine!'); } function helpIntent(conv) { conv.ask('Help response'); } express().use(bodyParser.json(), app).listen(8888)

请注意,您将需要了解action的sdk和lex运行时库,以便根据需要扩展上述代码. 这是实现您的目标的高级方法.

Please note that you will need to have understanding of action's sdk and lex runtime library to extend above code according to your need. This is high level approach to achieve your goal.

希望有帮助.

更多推荐

我可以将Amazon LEX与Google助手一起使用吗?

本文发布于:2023-10-16 11:41:37,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1497453.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:助手   Amazon   LEX   Google

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!