{"_id":"2ku-bot-message-parser","_rev":"9-586263cf4cc71349617a8ce874273f55","time":{"1.0.0":"2021-03-01T02:28:27.628Z","created":"2021-03-03T15:06:32.751Z","1.0.3":"2021-03-03T15:06:32.985Z","modified":"2022-04-04T10:19:21.123Z"},"name":"2ku-bot-message-parser","dist-tags":{"latest":"1.0.3"},"versions":{"1.0.3":{"author":{"name":"jdealla"},"bugs":{"url":"https://github.com/jdealla/2ku-bot-message-parser"},"dependencies":{"compromise":"^13.8.0","node-nlp":"^3.10.2","rf-logger":"^3.0.2"},"description":"a simple NLP tool for chatbots to extract data from user input","homepage":"https://github.com/jdealla/2ku-bot-message-parser#readme","license":"ISC","main":"index.js","name":"2ku-bot-message-parser","repository":{"type":"git","url":"git+https://github.com/jdealla/2ku-bot-message-parser.git"},"scripts":{"test":"node test"},"version":"1.0.3","devDependencies":{},"gitHead":"2c5d16d092f6f3b36707e099d686adc64437740b","_id":"2ku-bot-message-parser@1.0.3","_nodeVersion":"14.15.4","_npmVersion":"6.14.10","dist":{"integrity":"sha512-SrI0nAI8DSdjS2S78ou0f9Fms0luLU+BkzJeaS4VhY6d4ObeylPJRQj4kKf6jEmduXMPd873UbmbTWxCQDr0Iw==","shasum":"3c17a9e04efbabee07936e0e914a253cfed0db6b","tarball":"https://registry.npmjs.org/2ku-bot-message-parser/-/2ku-bot-message-parser-1.0.3.tgz","fileCount":13,"unpackedSize":234470,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgP6X5CRA9TVsSAnZWagAA3hEP/AgN63txCAUX6I8VFYJj\n3h0VOacjoQrd0aaFCzJF14Qq0vyZj+S5FaUAdHqvSdHpOWK/PqIY8sdbCZ0j\n5mh2hJcYkItmRRsV0n0sYJ43PoNPGB8Odw9/J8ka5wwlDWDtmPOl3PhMDFIp\neb7fxT/gwXCwqjFYWYEcYerSxL+ik6qf90l6FvJ+Jn/qd14VEEN1hQ6eeMA+\nqB14gMSFP5VhcPw6DGlT2iFO2oq1TwVWmcSAVfycKLkgVoDwb/itnzOwFv6L\n/DipNTqS4MH1bTc4kAUsni4TKMnep6F4yhuvi0NLtkdu/L1Cn4yOTOU4WWhB\n9H0J4ek8IZElU1Kbxee9UjtIRM6bRhn+71ROiMwFAgWLvb4oLEWwIjc9C9Ip\nTZd5AUiNIOa4aACt6nYoZYsw0Sgo7x54Ilcue370atZCr1uS8JX524lxKMza\n8g01rqo3G6awRYH3qRUjZuhWy3FaiTvby6bRxXUh7dlw0tRL9TMFbjUstDCL\neLwFw1YAEm1JaoB+jeJ+AwLZTWC4N41F8iplQozUIDG7w2BRZ8vzvE9W1fqb\nk6CTx03FPbM01aN5q9jlr0sSVoLBbLii3175VVt69XFSlLeTMLIiaqvOVaFj\nghXOMt1Poqb9aw0nAO+O5TuqCK5ONpKQXIZYTPjN+dCykJNurd+dijp+JeyC\nZ63M\r\n=ZkSo\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCDY2Ph6FDjAoNrNhcRpfQPwjPgWp+IVLXzIOl8IhKSjwIhAJN7vMtA8T1w0lBOf2ETf4NLXAcfpfyieay3je0+nyni"}]},"_npmUser":{"name":"jdealla","email":"jdealla@gmail.com"},"directories":{},"maintainers":[{"name":"jdealla","email":"jdealla@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/2ku-bot-message-parser_1.0.3_1614783992751_0.4693356659271559"},"_hasShrinkwrap":false}},"maintainers":[{"name":"jdealla","email":"jdealla@gmail.com"}],"description":"a simple NLP tool for chatbots to extract data from user input","homepage":"https://github.com/jdealla/2ku-bot-message-parser#readme","repository":{"type":"git","url":"git+https://github.com/jdealla/2ku-bot-message-parser.git"},"author":{"name":"jdealla"},"bugs":{"url":"https://github.com/jdealla/2ku-bot-message-parser"},"license":"ISC","readme":"# bot-message-parser\r\n\r\na simple tool for chatbots to extract useful data from user input.\r\n\r\n\r\n## operation\r\nCreate a new `BotMessageParser` object.\r\n\r\n```javascript\r\nconst BotMessageParser = require(\"bot-message-parser\")\r\n\r\nconst parser = new BotMessageParser({ \r\n    debug: false,\r\n    useCompromise: false,\r\n    commandPrefix: \"/\",\r\n    namesList: [\r\n        \"ryan forever\",\r\n        \"alice springs\"\r\n    ]\r\n});\r\n\r\nparser.process(text).then(console.log)\r\n````\r\n\r\n`.process()` is an async function and will produce the following outputs:\r\n\r\n`.raw`: the original text\r\n\r\n`.text`: the original text, flattned to lower case\r\n\r\n`.clean`: text cleaned of any punctuation, flattened to lowercase, and the dictionary mappings applied.\r\n\r\n`trigger`: the parsed trigger (i.e. !bot or !command, etc)\r\n\r\n`.hasTrigger`: `true` if message contains a trigger\r\n\r\n`.triggerOnly`: `true` if the message contains just the trigger\r\n\r\n`.yes`: `boolean` if user says something like \"yes\", \"yeah\", \"yep\", etc\r\n\r\n`.no`: `boolean` if user says something like \"no\", \"nah\", \"hell no\", etc\r\n\r\n`.maybe`: `boolean` if user says something like \"maybe\", \"not sure\", \"possibly\", etc\r\n\r\n`.idk`: `boolean` if user says something like \"idk\", \"i dont know\", \"no idea\". etc\r\n\r\n`.what`: `boolean` if user says something like \"what?\", \"huh?\",\"i dont understand\", etc\r\n\r\n`arguments`: converts the message string into an array that can be useful for getting arguments\r\n\r\n`names`: returns an array of found names, if a `namesList` is specified in settings\r\n\r\n`intent`: **NLP ONLY** intent of the message\r\n\r\n`numEntities`: **NLP ONLY** number of entities found\r\n\r\n`entities`: **NLP ONLY** an array of entities\r\n\r\n`sentiment`: **NLP ONLY** sentiment of the message (positive, negative, or neutral)\r\n\r\n\r\n## compromise\r\n\r\nin the options, if you set `useCompromise` to `true`, you can activate the nlp processing from [compromise](https://www.npmjs.com/package/compromise)\r\n\r\nthis will search for sever useful things in the message, such as `hashtags`, `urls`, `emails`, `phoneNumbers`, `verbs`, and `nouns`\r\n\r\n\r\n## nlp-js\r\n\r\ncurrently, this this uses [nlp-js](https://www.npmjs.com/package/@nlpjs/nlp) v3.10.0.  if you train a model using this module, you can specify a path to it in the options.\r\n\r\n## output\r\n```javascript\r\n\r\n/*\r\n\r\n{\r\n  id: undefined,\r\n  type: undefined,\r\n  timestamp: undefined,\r\n  raw: '/bot hello there? my name is ryan forever.  do you know ALICE SPRINGS?',\r\n  text: 'hello there? my name is ryan forever.  do you know ALICE SPRINGS?',\r\n  clean: 'hello there my name is ryan forever do you know alice springs',\r\n  attachments: undefined,\r\n  command: 'bot',\r\n  commandRaw: '/bot',\r\n  hasCommand: true,\r\n  commandOnly: false,\r\n  botMentioned: undefined,\r\n  yes: undefined,\r\n  no: undefined,\r\n  maybe: undefined,\r\n  idk: undefined,\r\n  what: undefined,\r\n  arguments: [\r\n    'hello',   'there',\r\n    'my',      'name',\r\n    'is',      'ryan',\r\n    'forever', 'do',\r\n    'you',     'know',\r\n    'alice',   'springs'\r\n  ],\r\n  names: [ 'ryan forever', 'alice springs' ],\r\n  hasIntent: undefined,\r\n  intent: undefined,\r\n  numEntities: 0,\r\n  entities: [],\r\n  sentiment: undefined,\r\n  hashtags: [],\r\n  urls: [],\r\n  emails: [],\r\n  phoneNumbers: [],\r\n  verbs: [],\r\n  nouns: []\r\n}\r\n\r\n*/\r\n```","readmeFilename":"README.md"}