Observed since 20 Oct, 19:14 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
a simple NLP tool for chatbots to extract data from user input
a simple tool for chatbots to extract useful data from user input.
Create a new BotMessageParser object.
const BotMessageParser = require("bot-message-parser")
const parser = new BotMessageParser({
debug: false,
useCompromise: false,
commandPrefix: "/",
namesList: [
"ryan forever",
"alice springs"
]
});
parser.process(text).then(console.log)
.process() is an async function and will produce the following outputs:
.raw: the original text
.text: the original text, flattned to lower case
.clean: text cleaned of any punctuation, flattened to lowercase, and the dictionary mappings applied.
trigger: the parsed trigger (i.e. !bot or !command, etc)
.hasTrigger: true if message contains a trigger
.triggerOnly: true if the message contains just the trigger
.yes: boolean if user says something like "yes", "yeah", "yep", etc
.no: boolean if user says something like "no", "nah", "hell no", etc
.maybe: boolean if user says something like "maybe", "not sure", "possibly", etc
.idk: boolean if user says something like "idk", "i dont know", "no idea". etc
.what: boolean if user says something like "what?", "huh?","i dont understand", etc
arguments: converts the message string into an array that can be useful for getting arguments
names: returns an array of found names, if a namesList is specified in settings
intent: NLP ONLY intent of the message
numEntities: NLP ONLY number of entities found
entities: NLP ONLY an array of entities
sentiment: NLP ONLY sentiment of the message (positive, negative, or neutral)
in the options, if you set useCompromise to true, you can activate the nlp processing from compromise
this will search for sever useful things in the message, such as hashtags, urls, emails, phoneNumbers, verbs, and nouns
currently, this this uses nlp-js v3.10.0. if you train a model using this module, you can specify a path to it in the options.
/*
{
id: undefined,
type: undefined,
timestamp: undefined,
raw: '/bot hello there? my name is ryan forever. do you know ALICE SPRINGS?',
text: 'hello there? my name is ryan forever. do you know ALICE SPRINGS?',
clean: 'hello there my name is ryan forever do you know alice springs',
attachments: undefined,
command: 'bot',
commandRaw: '/bot',
hasCommand: true,
commandOnly: false,
botMentioned: undefined,
yes: undefined,
no: undefined,
maybe: undefined,
idk: undefined,
what: undefined,
arguments: [
'hello', 'there',
'my', 'name',
'is', 'ryan',
'forever', 'do',
'you', 'know',
'alice', 'springs'
],
names: [ 'ryan forever', 'alice springs' ],
hasIntent: undefined,
intent: undefined,
numEntities: 0,
entities: [],
sentiment: undefined,
hashtags: [],
urls: [],
emails: [],
phoneNumbers: [],
verbs: [],
nouns: []
}
*/
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 1.0.3Registry latest | 3 Mar 2021 | 3 |
This describes our collected data; it is not a security assessment.
Shared repository data · GitHub
Observed since 20 Oct, 19:14 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:2918a93b802ae6b0255df32ccd381b043fc4a489cf55dd6fc27a9140c106e19f