wit-keywords
v1.0.0
Published
Mass push values to keyword based entities on Wit.ai
Downloads
2
Readme
wit-keywords
Mass push values to keyword based entities on Wit.ai
Installation
npm install wit-keywords --save
Usage
Push an array of actors to the actor entity
const keywords = require('wit-keywords');
new keywords(process.env.WIT_TOKEN)
.entity('actor')
.push([
'Leonardo DiCaprio',
'Steve Carell',
'Alec Baldwin',
'Micheal Cera'
])
.then(response => console.log(response))
.catch(err => console.log(err));
//=> [{
//=> value: 'Leonardo DiCaprio',
//=> status: 'added'
//=> }, {}, {}, {}]
Trigger a function after
each pushed item
const keywords = require('wit-keywords');
new keywords(process.env.WIT_TOKEN)
.entity('actor')
.after(actor => {
// Do something
})
.push([
'Leonardo DiCaprio',
'Steve Carell',
'Alec Baldwin',
'Micheal Cera'
]);
Trigger a function after
each pushed item
const keywords = require('wit-keywords');
new keywords(process.env.WIT_TOKEN)
.entity('actor')
.after(actor => {
// Do something
})
.push([
'Leonardo DiCaprio',
'Steve Carell',
'Alec Baldwin',
'Micheal Cera'
]);
Set custom number of parallel requests (concurrency
)
const keywords = require('wit-keywords');
new keywords(process.env.WIT_TOKEN)
.concurrency(4) // Default = 3
.entity('actor')
.after(actor => {
// Do something
})
.push([
'Leonardo DiCaprio',
'Steve Carell',
'Alec Baldwin',
'Micheal Cera'
]);
License
MIT © Daniel Eckermann