简体   繁体   中英

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

so the following code from 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

const { dialogflow } = require('actions-on-google');
const app = dialogflow();

app.intent('Default Welcome Intent', conv => {   conv.ask('How are you?'); });

or Actions SDK module

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.

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. 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. If you don't you can use Dialog Flow as the NLP and its library.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM