[英]Why should I used dialogflow() over actionssdk() in Actions on Google Nodejs client Library
Based on the V1 to V2 Node.js Client Library Migration guide there are two ways of listening to conversations 根据V1到V2的Node.js客户端库迁移指南 ,有两种收听对话的方法
so the following code from V1 所以下面的代码来自V1
const {DialogflowApp } = require('actions-on-google');
const actionMap = new Map();
actionMap.set('input.welcome', app => { app.ask('How are you?'); });
...
can be replaced with either the dialogflow module 可以替换为dialogflow模块
const { dialogflow } = require('actions-on-google');
const app = dialogflow();
app.intent('Default Welcome Intent', conv => { conv.ask('How are you?'); });
or Actions SDK module 或Actions SDK模块
const { actionssdk } = require('actions-on-google');
const app = actionssdk();
app.intent('actions.intent.MAIN', conv => { conv.ask('How are you?'); });
In the first case (dialogflow) you recongize the Intent by its name but at the second (actionSdk) you recognize it from the actions name. 在第一种情况(对话框流)中,您通过其名称重新识别了Intent,而在第二种情况(actionSdk)中,您从操作名称中识别了它。
Why should I use one over the other and what are the benefits and limitations of each method? 为什么我要一个接一个地使用?每种方法的优点和局限性是什么?
Both libraries will deliver the transcription of what the user of your Action has said. 这两个库都将传递您的Action用户所说的内容。 Which library you use depends on how you intend to understand the text - to make sense of it and react accordingly.
您使用哪个库取决于您打算如何理解文本-理解文本并做出相应反应。 If you plan to parse it in a bespoke manner or if you have your own natural language processor (aka NLP/NLU) you use the Actions SDK.
如果您打算以定制的方式对其进行解析,或者您拥有自己的自然语言处理器(又名NLP / NLU),则可以使用Actions SDK。 If you don't you can use Dialog Flow as the NLP and its library.
如果不这样做,则可以将Dialog Flow用作NLP及其库。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.