An NLP library for building bots, with entity extraction, sentiment analysis, automatic language identify, and so more

Overview

NLPjs logo

NLP.js

Build Status Coverage Status NPM version NPM downloads Sonarcloud Status Maintainability Rating Reliability Rating Security Rating

If you're looking for the version 3 docs, you can find them here Version 3

"NLP.js" is a general natural language utility for nodejs. Currently supporting:

  • Guess the language of a phrase
  • Fast Levenshtein distance of two strings
  • Search the best substring of a string with less Levenshtein distance to a given pattern.
  • Get stemmers and tokenizers for several languages.
  • Sentiment Analysis for phrases (with negation support).
  • Named Entity Recognition and management, multi-language support, and acceptance of similar strings, so the introduced text does not need to be exact.
  • Natural Language Processing Classifier, to classify an utterance into intents.
  • NLP Manager: a tool able to manage several languages, the Named Entities for each language, the utterances, and intents for the training of the classifier, and for a given utterance return the entity extraction, the intent classification and the sentiment analysis. Also, it is able to maintain a Natural Language Generation Manager for the answers.
  • 40 languages natively supported, 104 languages supported with BERT integration
  • Any other language is supported through tokenization, even fantasy languages

Hybrid bot

New in version 4!

Version 4 is very different from previous versions. Before this version, NLP.js was a monolithic library. The big changes:

  • Now the library is split into small independent packages.
  • So every language has its own package
  • It provides a plugin system, so you can provide your own plugins or replace the existing ones.
  • It provides a container system for the plugins, settings for the plugins and also pipelines
  • A pipeline is code defining how the plugins interact. Usually it is linear: there is an input into the plugin, and this generates the input for the next one. As an example, the preparation of a utterance (the process to convert the utterance to a hashmap of stemmed features) is now a pipeline like this: normalize -> tokenize -> removeStopwords -> stem -> arrToObj
  • There is a simple compiler for the pipelines, but they can also be built using a modified version of javascript and python (compilers are also included as plugins, so other languages can be added as a plugin).
  • NLP.js now includes connectors, a connector is understood to be something that has at least 2 methods: hear and say. Examples of connectors included: Console Connector, Microsoft Bot Framework Connector and a Direct Line Offline Connector (this one allows you to build a web chatbot using the Microsoft Webchat, but without having to deploy anything in Azure).
  • Some plugins can be registered by language, so for different languages different plugins will be used. Also some plugins, like NLU, can be registered not only by language but also by domain (a functional set of intents that can be trained separately)
  • As an example of per-language/domain plugins, a Microsoft LUIS NLU plugin is provided. You can configure your chatbot to use the NLU from NLP.js for some languages/domains, and LUIS for other languages/domains.
  • Having plugins and pipelines makes it possible to write chatbots by only modifying the configuration and the pipelines file, without modifying the code.

TABLE OF CONTENTS

Installation

If you're looking to use NLP.js in your Node application, you can install via NPM like so:

    npm install node-nlp

React Native

There is a version of NLP.js that works in React Native, so you can build chatbots that can be trained and executed on the mobile even without the internet. You can install it via NPM:

    npm install node-nlp-rn

Some limitations:

  • No Chinese
  • The Japanese stemmer is not the complete one
  • No Excel import
  • No loading from a file, or saving to a file, but it can still import from JSON and export to JSON.

Example of use

You can see a great example of use in the folder /examples/02-qna-classic. This example is able to train the bot and save the model to a file, so when the bot is started again, the model is loaded instead of being trained again.

You can start to build your NLP from scratch with a few lines:

const { NlpManager } = require('node-nlp');

const manager = new NlpManager({ languages: ['en'], forceNER: true });
// Adds the utterances and intents for the NLP
manager.addDocument('en', 'goodbye for now', 'greetings.bye');
manager.addDocument('en', 'bye bye take care', 'greetings.bye');
manager.addDocument('en', 'okay see you later', 'greetings.bye');
manager.addDocument('en', 'bye for now', 'greetings.bye');
manager.addDocument('en', 'i must go', 'greetings.bye');
manager.addDocument('en', 'hello', 'greetings.hello');
manager.addDocument('en', 'hi', 'greetings.hello');
manager.addDocument('en', 'howdy', 'greetings.hello');

// Train also the NLG
manager.addAnswer('en', 'greetings.bye', 'Till next time');
manager.addAnswer('en', 'greetings.bye', 'see you soon!');
manager.addAnswer('en', 'greetings.hello', 'Hey there!');
manager.addAnswer('en', 'greetings.hello', 'Greetings!');

// Train and save the model.
(async() => {
    await manager.train();
    manager.save();
    const response = await manager.process('en', 'I should go now');
    console.log(response);
})();

This produces the following result in a console:

{ utterance: 'I should go now',
  locale: 'en',
  languageGuessed: false,
  localeIso2: 'en',
  language: 'English',
  domain: 'default',
  classifications:
   [ { label: 'greetings.bye', value: 0.698219120207268 },
     { label: 'None', value: 0.30178087979273216 },
     { label: 'greetings.hello', value: 0 } ],
  intent: 'greetings.bye',
  score: 0.698219120207268,
  entities:
   [ { start: 12,
       end: 14,
       len: 3,
       accuracy: 0.95,
       sourceText: 'now',
       utteranceText: 'now',
       entity: 'datetime',
       resolution: [Object] } ],
  sentiment:
   { score: 1,
     comparative: 0.25,
     vote: 'positive',
     numWords: 4,
     numHits: 2,
     type: 'senticon',
     language: 'en' },
  actions: [],
  srcAnswer: 'Till next time',
  answer: 'Till next time' }

False Positives

By default, the neural network tries to avoid false positives. To achieve that, one of the internal processes is that words never seen by the network are represented as a feature that gives some weight to the None intent. So, if you try the previous example with "I have to go" it will return the None intent because 2 of the 4 words have never been seen while training. If you don't want to avoid those false positives, and you feel more comfortable with classifications into the intents that you declare, then you can disable this behavior by setting the useNoneFeature to false:

const manager = new NlpManager({ languages: ['en'], nlu: { useNoneFeature: false } });

Log Training Progress

You can also add a log progress, so you can trace what is happening during the training. You can log the progress to the console:

const nlpManager = new NlpManager({ languages: ['en'], nlu: { log: true } });

Or you can provide your own log function:

const logfn = (status, time) => console.log(status, time);
const nlpManager = new NlpManager({ languages: ['en'], nlu: { log: logfn } });

Contributing

You can read the guide for how to contribute at Contributing.

Contributors

Contributors

Made with contributors-img.

Code of Conduct

You can read the Code of Conduct at Code of Conduct.

Who is behind it?

This project is developed by AXA Group Operations Spain S.A.

If you need to contact us, you can do it at the email [email protected]

License

Copyright (c) AXA Group Operations Spain S.A.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Comments
  • Performance of findEntities. Any tips to improve?

    Performance of findEntities. Any tips to improve?

    I am using the the NerManager to create named entities and am also using the React Native version of the library.

    For my use case there are 10,000 airports...this is the named entity I am adding...

            this.ner.addNamedEntityText(
                'airport',
                airport.airportId,
                ['en'],
                [airport.name, airport.shortName, getAirportAcronymn(airportCode," "), airportCode, getNatoPhonetic(airportCode)]
              );
    

    I then am passing this content to findEntities...

    What is the elevation of Allegheny County Airport

    It takes 40+ seconds to return the result. It does successfully return that there is an airport entity in the string.

    When I get rid of all of the synonyms it still takes 15 seconds. Without the synonyms though, it wouldn't be that useful because there are multiple ways to say.

    For this use case I am only adding one named entity type, but I assume if I add many more the performance would keep decreasing.

    Any tips?

    opened by jeffbonasso-ambifi 34
  • feat: Optimize slot finding answer processing

    feat: Optimize slot finding answer processing

    Pull Request Template

    PR Checklist

    • [x] I have run npm test locally and all tests are passing.
    • [x] I have added/updated tests for any new behavior.
    • [x] If this is a significant change, an issue has already been created where the problem / solution was discussed: [N/A, or add link to issue here]

    I currently can not intall the project because of issues reported with some used tarballs. WHen I execute the tests eslint reports 16 errors and 47 warnings all over the place. I can try to fix them, but So I decided to not add new tests. Please tell me if needed

    PR Description

    While checking out slot Filling with v4 I encountered several unexpected topics I solve in this PR:

    • When using slot filling there was a "srcAnswer" property added to the result, but this was not processed like the other answers by nlg. The PR adds that
    • the nlg text rendering had an issue that when a contact was set that then "optional answer text" was not processed because done but ignored and original text was used. PR also addresses that
    • The answers were rendered before the slot filling filled relevant entities. This PR adjust the order of actions to allow entities to be rendered correctly
    • When a slot was requested the full uterance was always filled as entity - also if the entity was already parsed by buoltins or such. This lead to duplicated entries. This PR changes it so that the fallback "full utterance" is only added as entity if not filled already
    • If a context contains a earlier srcAnswer property then this was repeated also if all mandatory entities were filled in the meantime. This PR removes the srcAnswer if all mandatory entities are filled.
    • If slot filling is used the nlp code adds a special "entity utterance", but uses the initial locale parameter (whcih could be empty) to create this. This pot. leads to an empty locale used and then ner only uses the default builtins and not the configured builtins (e.g, Duckling). This PR uses a potentially already determinded locale.
    • When slot filling generated an answer this was provided in srcAnwer additionally to pot. a normal "answer". DirectLineConnector as example is not sending back srcAnswer, so the question is not sent out. This PR changes the behaviour so that when the srcAnswer property is set this is also used as "answer", because it is "the better answer" :-)
    • Actions are executed after the answers are rendered. With this actions can not modify the context to e.g. inkject new entities to be used in answer rendering. This PR adds a new nlp setting "executeActionsBeforeAnswers" to allow to execute the actions before answer rendering.
    • Fix handling of numbered entities in slot filling and answer generation (added it here because else would have conflicted with PR #1164)

    In fact it is a feature addition for handing slot filling answers by processing them like the other answers.

    addresses #410, addresses #454, addresses #934, fixes #582, fixes #307

    Additonally the commits are not "convenionally named". Sorry for that. Saw that too late and will change in future commits

    opened by Apollon77 20
  • Big Amount of data big delay train

    Big Amount of data big delay train

    Describe the bug 4 days pass to train 415703 inputs ?? and its not done yet..

    To Reproduce Steps to reproduce the behavior: image

    Expected behavior It took 35 hours just to load all data

    **Desktop **

    • OS: Windows 10
    • Browser Node JS 10.15
    • Version latest

    PC info : CPU : Core i7 4770 @3.40 GHz Ram : 16 GB GPU : GTX 750

    image

    image

    Its normal for that amont of data ???

    opened by ran-j 17
  • Cannot destructure property 'intent' of 'input.classifications[0]' as it is undefined.

    Cannot destructure property 'intent' of 'input.classifications[0]' as it is undefined.

    Sometimes getting an error message when running NlpManager.process (version 4.14.2)

    UnhandledPromiseRejectionWarning: TypeError: Cannot destructure property 'intent' of 'input.classifications[0]' as it is undefined.
    

    at @nlpjs/nlu/src/nlu-neural.js:41:13

    input.classifications will in these scenarios be an empty array, which causes the following line to fail: const { intent } = input.classifications[0];

    Here's what i'm doing in code, don't think there's anything very special here:

      const nlpManager = new NlpManager({ languages: ['sv'], nlu: { log: false } });
      for (const {text, expected_classification} of inputs1) {
        nlpManager.addDocument('sv', text, expected_classification);
      }
      await nlpManager.train();
      for (const { text } of inputs2) {
          const classifications = await nlpManager.process(text); // throws error for some inputs
         // check classification
      }
    
    opened by Dadibom 16
  • build(deps): bump mongodb from 3.6.5 to 4.1.0

    build(deps): bump mongodb from 3.6.5 to 4.1.0

    Bumps mongodb from 3.6.5 to 4.1.0.

    Release notes

    Sourced from mongodb's releases.

    v4.1.0

    The MongoDB Node.js team is pleased to announce version 4.1.0 of the mongodb package!

    Release Highlights

    This release includes load balancer support, intended for use with the beta Serverless platform. When using the driver with Serverless, the SRV URI will automatically put the driver into this mode. When wanting to use a non-SRV URI one must add the loadBalanced=true option to the URI to put the driver into this mode. Being in this mode enables the driver to properly route transactions and cursors to the correct service behind the load balancer.

    The release also fixes an important bug where the original release of the v4 driver enabled command monitoring by default, which caused many reported observations of performance degradation when upgrading from v3 of the driver. Command monitoring is now once again disabled by default and must be enabled by passing in { monitorCommands: true } to the client if desired.

    Features

    • NODE-2843: implement sessions advanceClusterTime method (#2920) (1fd0244)
    • NODE-3011: Load Balancer Support (#2909) (c554a7a)

    Bug Fixes

    • NODE-2883: Aggregate Operation should not require parent parameter (#2918) (dc6e2d6)
    • NODE-3058: accept null or undefined anywhere we permit nullish values (#2921) (b42a1b4)
    • NODE-3441: fix typings for createIndexes (#2915) (f87f376)
    • NODE-3442: AsyncIterator has incorrect return type (#2916) (4a10389)
    • NODE-3452: readonly filters not permitted by typings (#2927) (ce51e78)
    • NODE-3510: omit incorrect | void in declaration of Promise overload of rename() (#2922) (58c1e84)
    • NODE-3513: default command monitoring to off (#2926) (3c60245)

    Documentation

    We invite you to try the mongodb library immediately, and report any issues to the NODE project.

    v4.0.1

    The MongoDB Node.js team is pleased to announce version 4.0.1 of the mongodb package!

    Release Highlights

    This release fixes two small but important bugs from our 4.0.0 release:

    • Webpack will no longer throw an error when trying to bundle the driver
    • Snapshot sessions will now correctly apply the snapshot time when initiated with a distinct operation

    We hope this improves your upgrade experience!

    Bug Fixes

    • NODE-3199: unable to bundle driver due to uncaught require (#2904) (9e48bbd)
    • NODE-3393: snapshot time not applied if distinct executed first (#2908) (7aa3008)
    • NODE-3417: allow calling db() before MongoClient is connected (#2889) (51ea86d)

    ... (truncated)

    Changelog

    Sourced from mongodb's changelog.

    Changes in 4.x (and how to migrate!)

    Hello dear reader, thank you for adopting version 4.x of the MongoDB Node.js driver, from the bottom of our developer hearts we thank you so much for taking the time to upgrade to our latest and greatest offering of a stunning database experience. We hope you enjoy your upgrade experience and this guide gives you all the answers you are searching for. If anything, and we mean anything, hinders your upgrade experience please let us know via JIRA. We know breaking changes are hard but they are sometimes for the best. Anyway, enjoy the guide, see you at the end!

    Key Changes

    Typescript

    We've migrated the driver to Typescript! Users can now harness the power of type hinting and intellisense in editors that support it to develop their MongoDB applications. Even pure JavaScript projects can benefit from the type definitions with the right linting setup. Along with the type hinting there's consistent and helpful docs formatting that editors should be able to display while developing. Recently we migrated our BSON library to TypeScript as well, this version of the driver pulls in that change.

    Community Types users (@​types/mongodb)

    If you are a user of the community types (@​types/mongodb) there will likely be compilation errors while adopting the types from our codebase. Unfortunately we could not achieve a one to one match in types due to the details of writing the codebase in Typescript vs definitions for the user layer API along with the breaking changes of this major version. Please let us know if there's anything that is a blocker to upgrading on JIRA.

    Node.js Version

    We now require node 12.9 or greater for version 4 of the driver. If that's outside your support matrix at this time, that's okay! Bug fix support for our 3.x branch will not be ending until summer 2022, which has support going back as far as Node.js v4!

    Cursor changes

    Affected classes:

    • AbstractCursor
    • FindCursor
    • AggregationCursor
    • ChangeStreamCursor
      • This is the underlying cursor for ChangeStream
    • ListCollectionsCursor

    Our Cursor implementation has been updated to clarify what is possible before and after execution of an operation. Take this example:

    const cursor = collection.find({ a: 2.3 }).skip(1);
    for await (const doc of cursor) {
      console.log(doc);
      fc.limit(1); // bad.
    }
    

    ... (truncated)

    Commits
    • 4ecaa37 chore(release): 4.1.0
    • ce51e78 fix(NODE-3452): readonly filters not permitted by typings (#2927)
    • c554a7a feat(NODE-3011): Load Balancer Support (#2909)
    • 3c60245 fix(NODE-3513): default command monitoring to off (#2926)
    • 58c1e84 fix(NODE-3510): omit incorrect | void in declaration of Promise overload of...
    • 1fd0244 feat(NODE-2843): implement sessions advanceClusterTime method (#2920)
    • a9c0de8 refactor(NODE-3421): replace MongoDriverError instances with MongoRuntimeErro...
    • b42a1b4 fix(NODE-3058): accept null or undefined anywhere we permit nullish values (#...
    • dc6e2d6 fix(NODE-2883): Aggregate Operation should not require parent parameter (#2918)
    • 967c193 refactor(NODE-3402): implement MongoAPIError and its children (#2891)
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 14
  • How to train entities/slots using corpus?

    How to train entities/slots using corpus?

    Summary

    I'd prefer to use a corpus file instead of hand-coding my training declarations, but it's unclear how to annotate entities/slots in the training file.

    Context

    If I use a corpus consisting of objects per the existing examples (see below example), everything works fine and the intent/answer are correctly recognized.

    {
          "intent": "tell_me_a_joke",
          "utterances": [
            "Tell me a joke",
            "Can you tell me a joke?",
            "I want to hear a joke",
            "make me laugh",
            "tell me something funny"
          ],
          "answers": ["Knock knock"]
        }
    

    However, I want to extract information from some of my intents (see below mock example) to avoid ping-ponging the user for information they've already shared. I've attempted to use % notation as seen below, but it completely breaks that intent altogether it seems.

    {
          "intent": "tell_me_a_joke",
          "utterances": [
            "Tell me a joke about %type%",
            "Can you tell me a %type% joke?",
            "I want to hear a %type% joke",
            "make me laugh",
            "tell me something funny"
          ],
          "answers": ["What type of joke do you want to hear?"]
        }
    

    Example above is trivial, but the general gist is I'd expect the framework to take this and extract out the entity into a slot. However, I have no idea how to approach this if I'm using a corpus. Any examples/guidance would be fabulous.

    Your Environment

    | Software | Version | |----------------------|---------| | nlp.js | 4.10.5 | | node | 13.13.0 | | npm | 6.14.4 | | Operating System | macOS |

    opened by radicand 14
  • Detect gibberish

    Detect gibberish

    Is your feature request related to a problem? Please describe. Sometimes when chatting with a chatbot application, users end up typing gibberish like: asdasd sadasd or fgfsad dasdsa etc. Is there a way to detect gibberish?

    Describe the solution you'd like Detect gibberish input using NLP

    Describe alternatives you've considered https://github.com/rrenaud/Gibberish-Detector (python based)

    opened by atulmy 13
  • Parallelize computeThetas to reduce training time

    Parallelize computeThetas to reduce training time

    Is your feature request related to a problem? Please describe. Training time can be reduced by using worker_threads (when available based on the node version).

    Describe the solution you'd like Computing Thetas does a descend of gradient that is unique for each classification label, so the calculation of the theta can be theorically executed threaded:

    https://github.com/axa-group/nlp.js/blob/master/lib/math/mathops.js#L165

    enhancement help wanted 
    opened by jesus-seijas-sp 13
  • Can't install with NPM (No matching version found for @nlpjs/evaluator@^4.22.2.)

    Can't install with NPM (No matching version found for @nlpjs/[email protected]^4.22.2.)

    Hi, first of all, thanks fo all the work you do here. Today my jenkins process didn't compile, with the next error. To verify that it was a global problem I tryed to install in empty folder and I get the same result. So I guess that is a new bug.

    Describe the bug When I try to install library takes this error:

    $ npm i @nlpjs/basic

    npm ERR! code ETARGET npm ERR! notarget No matching version found for @nlpjs/[email protected]^4.22.2. npm ERR! notarget In most cases you or one of your dependencies are requesting npm ERR! notarget a package version that doesn't exist. npm ERR! notarget npm ERR! notarget It was specified as a dependency of '@nlpjs/basic' npm ERR! notarget

    To Reproduce npm i @nlpjs/basic in a fresh folder NPM Version: 6.14.4

    opened by fred2458 12
  • An in-range update of eslint-plugin-jest is breaking the build 🚨

    An in-range update of eslint-plugin-jest is breaking the build 🚨

    The devDependency eslint-plugin-jest was updated from 22.9.0 to 22.10.0.

    🚨 View failing branch.

    This version is covered by your current version range and after updating it in your project the build failed.

    eslint-plugin-jest is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

    Status Details

    Release Notes for v22.10.0

    22.10.0 (2019-07-17)

    Features

    Commits

    The new version differs by 7 commits.

    • 28bd1dc feat(rules): adds no-if rule (#293)
    • 7ebdc0e chore: enforce import destructure order
    • 31c7cef chore: convert to import/export (#302)
    • 9f858cb chore: delete tests instead of ignoring them with babel
    • c595ba0 chore: do not include tests in published tarball
    • 4b4eb78 chore: fix lint error in md file
    • d3ea720 chore(docs): fix typo (#304)

    See the full diff

    FAQ and help

    There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


    Your Greenkeeper Bot :palm_tree:

    greenkeeper 
    opened by greenkeeper[bot] 12
  • media url added to answer, save benchmark model, classifier timeout

    media url added to answer, save benchmark model, classifier timeout

    Pull Request Template

    PR Checklist

    • [ ] I have run npm test locally and all tests are passing.
    lib\nlp\nlp-manager.js
      344:16  error  Unexpected string concatenation    prefer-template
    

    I don't know "templates".

    345:14 error Unnecessary 'else' after 'return' no-else-return as in lib\ner\ner-manager.js 254:12

    • [ ] I have added/updated tests for any new behavior. Don't know I to do it

    • [ ] If this is a significant change, an issue has already been created where the problem / solution was discussed: N/A

    PR Description

    Adding a media url field to the answer to be able, later, to reply with some picture, audio in addition to text. Exemple: Barcelona + pic of Sagrada Família.

    If this idea is validated, media should be present in result, outside the answer (result.media). This might change the format, so I won't touch it without approbation.

    Addtionally, url could be used to gather information to pass to the asnwer (with a timeout). Using result.media, result.mediaGETheader, result.usemedia Exemple:

    manager.addAnswer(
    'en',
    'travel',
    'You want to travel from {{ fromCity }} to {{ toCity }} {{ date }}',
    '',
    'https://pubapi.atadi.vn/air/test/search/{{fromCity}}/{{toCity}}/{{formatteddate}}/100',
    'header Authorization: NNNNN',
    true
    };
    

    See https://documenter.getpostman.com/view/55211/atadi-public-api/RW1emdSE#929e7b76-fd97-4dd9-b5a1-cf8b2b8179d3 implying the need to add header and auth information in answer.

    Feel free to rewrite/adapt.

    opened by j2l 12
  • Enhance Slot-manager with additional informations and a method

    Enhance Slot-manager with additional informations and a method

    Pull Request Template

    PR Checklist

    • [x] I have run npm test locally and all tests are passing.
    • [x] I have added/updated tests for any new behavior.
    • [ ] If this is a significant change, an issue has already been created where the problem / solution was discussed: [N/A, or add link to issue here]

    PR Description

    This PR mainly provides additional information on slot filling:

    • a new property in result.slotFill states which slot/entity was filled in the current/latest run
    • a new property in the entities called isSlotFillingFallback flags an entity by filled by the defined fallback logic (when trying to fill a specific slow but the given answer do not match to a property then tze full answer is filled, but in fact it is a "special" way to fill the slot. So a developer can not check and handle this

    Additionally the slot-manager geta a new method to get the info if a intenthas entities defined.

    opened by Apollon77 1
  • fix: locale of import should have precedence over settings locale

    fix: locale of import should have precedence over settings locale

    Pull Request Template

    PR Checklist

    • [x] I have run npm test locally and all tests are passing.
    • [ ] I have added/updated tests for any new behavior.
    • [ ] If this is a significant change, an issue has already been created where the problem / solution was discussed: [N/A, or add link to issue here]

    PR Description

    Because of wrongly set brackets the "input.locale" was in fact never used as soon as also a settings locale was set - and if nothing in settings it was falling back to "en".

    This PR adjusts the brackets in the condition.

    This was coming from a issue in the repository, but I do not know which anymore (sorry)

    I decided to not adjust tests because it is obvious to mem that the brackets are wrong.

    opened by Apollon77 1
  • bot.process crash when `say {{obj.prop}}` with `context.obj` null. Cannot be catched

    bot.process crash when `say {{obj.prop}}` with `context.obj` null. Cannot be catched

    Describe the bug I'm using directline controller to addActivities to the bot and wait for the response.

    Let's suppose we have a dialog like this:

    dialog someDialog
     say {{issue.value}}
    

    If context.issue === null then the bot crashes and cannot be catched from calling code. Problem is that bot.process(session) crashes and there is no way to reject the promise.

    The problem is that it calls executeAction and it goes to session.say --> compile and then the processString evaluator crashes

    Stack trace:

    opened by miqmago 3
  • build(deps): bump compromise from 13.11.4 to 14.8.0

    build(deps): bump compromise from 13.11.4 to 14.8.0

    Bumps compromise from 13.11.4 to 14.8.0.

    Release notes

    Sourced from compromise's releases.

    14.8.0

    • [fix] - tagging fixes
    • [new] - add Person .presumedMale(), .presumedFemale() methods
    • [new] - add Pronoun class, .refersTo()
    • [new] - add Noun.references()
    • [new] - .nouns('spencer') shorthand as an if-match
    • [change] - "[do] you .." etc now #QuestionWord
    • [new] - add #Hyphenated tag
    • [fix] - improved Auxiliary verb tagging
    • [update] - dependencies

    14.7.1

    • [fix] - concat fix
    • [change] - tagging fixes
    • [change] - {word/tag/sense} sense-match syntax

    14.7.0

    • [new] - match term id
    • [change] - tag text by default on .concat('')
    • [change] - allow modifying term prePunctuation
    • [new] - .wrap() method
    • [new] - .isFull() method
    • [new] - support full notIf matches on sweep
    • [fix] - text params for #953
    • [fix] - nouns().isSingular() missing
    • [change] - one-character w/ dash tokenization #977
    • [change] - allow setting model.one.prePunctuation + postPunctuation
    • [fix] - compromise-paragraphs plugin

    14.6.0

    • [change] - move internal conjugation methods
    • [update] - github scripts
    • [change] - fixes to .clauses() parser
    • [change] - an astrix is not a word
    • [new] - @​hasColon method
    • [new] - @​hasDash supports two dashes
    • [new] - #Passive verb tag
    • [new] - existential #There tag
    • [new] - add tense info to sentence json
    • [fix] - verb tokenization issues
    • [fix] - .replace() issues
    • [update] - dependencies

    14.5.2

    • [fix] - runtime error #965
    • [fix] - misc possessive tagging issues
    • [update] - dependencies

    14.5.1

    • [fix] - .remove() fixes

    ... (truncated)

    Changelog

    Sourced from compromise's changelog.

    14.8.0

    • [fix] - tagging fixes
    • [new] - add Person .presumedMale(), .presumedFemale() methods
    • [new] - add Pronoun class, .refersTo()
    • [new] - add Noun.references()
    • [new] - .nouns('spencer') shorthand as an if-match
    • [change] - "[do] you .." etc now #QuestionWord
    • [new] - add #Hyphenated tag
    • [fix] - improved Auxiliary verb tagging
    • [update] - dependencies

    14.7.1

    • [fix] - concat fix
    • [change] - tagging fixes
    • [change] - {word/tag/sense} sense-match syntax

    14.7.0

    • [new] - match term id
    • [change] - tag text by default on .concat('')
    • [change] - allow modifying term prePunctuation
    • [new] - .wrap() method
    • [new] - .isFull() method
    • [new] - support full notIf matches on sweep
    • [fix] - text params for #953
    • [fix] - nouns().isSingular() missing
    • [change] - one-character w/ dash tokenization #977
    • [change] - allow setting model.one.prePunctuation + postPunctuation
    • [fix] - compromise-paragraphs plugin

    14.6.0 [Oct 2022]

    • [change] - move internal conjugation methods
    • [update] - github scripts
    • [change] - fixes to .clauses() parser
    • [change] - an astrix is not a word
    • [new] - @​hasColon method
    • [new] - @​hasDash supports two dashes
    • [new] - #Passive verb tag
    • [new] - existential #There tag
    • [new] - add tense info to sentence json
    • [fix] - verb tokenization issues
    • [fix] - .replace() issues
    • [update] - dependencies

    14.5.2 [Oct 2022]

    • [fix] - runtime error #965
    • [fix] - misc possessive tagging issues
    • [update] - dependencies

    14.5.1 [Oct 2022]

    • [fix] - .remove() fixes

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies javascript 
    opened by dependabot[bot] 1
  • build(deps): bump parse-path and lerna

    build(deps): bump parse-path and lerna

    Bumps parse-path to 7.0.0 and updates ancestor dependency lerna. These dependencies need to be updated together.

    Updates parse-path from 4.0.4 to 7.0.0

    Release notes

    Sourced from parse-path's releases.

    7.0.0

    Add the parse_failed property — whether the input was parsed successfully or not.

    6.0.0

    parse-path 6.0.0

    Breaking changes

    • The resource property will not contain the port anymore. Added the host property which has the port too.

    5.0.0

    parse-path 5.0.0

    :star: This is a major release of parse-path! :star:

    Breaking changes

    • parse-path will not parse [email protected] ssh URLs anymore. Use parse-url for that.
    • If the input url has a trailing slash, the trailing slash will be added in the pathname too.
    • The port field is a string. By default empty.
    • Added the password field (default: "")
    • The resource may contain the port in it (e.g. resource: "domain.com:4200").

    Features

    • Faster
    • More secure
    • Cleaner codebase

    Any questions, suggestions, contributions are always welcome! :blush:

    Commits

    Updates lerna from 4.0.0 to 6.0.3

    Release notes

    Sourced from lerna's releases.

    v6.0.3

    6.0.3 (2022-11-07)

    Bug Fixes

    • publish: support inconsistent workspace prefix usage (#3413) (da2274b)
    • version: only apply prettier if it was explicitly installed (#3406) (0161bbe)

    v6.0.2

    6.0.2 (2022-11-02)

    Bug Fixes

    • publish: remove workspace prefix on publish (#3397) (1f0e546)

    v6.0.1

    6.0.1 (2022-10-14)

    Bug Fixes

    • run: allow for loading of env files to be skipped (#3375) (5dbd904)

    v6.0.0

    6.0.0 (2022-10-12)

    Super fast, modern task-runner implementation for lerna run

    As of version 6.0.0, Lerna will now delegate the implementation details of the lerna run command to the super fast, modern task-runner (powered by Nx) by default.

    If for some reason you wish to opt in to the legacy task-runner implementation details (powered by p-map and p-queue), you can do so by setting "useNx": false in your lerna.json. (Please let us know via a Github issue if you feel the need to do that, however, as in general the new task-runner should just work how you expect it to as a lerna user).

    Interactive configurtion for lerna run caching and task pipelines via the new lerna add-caching command

    When using the modern task-runner implementation described above, the way to get the most out of it is to tell it about the outputs of your various scripts, and also any relationships that exist between them (such as needing to run the build script before the test, for example).

    Simply run lerna add-caching and follow the instructions in order to generate all the relevant configuration for your workspace.

    You can learn more about the configuration it generates here: https://lerna.js.org/docs/concepts/task-pipeline-configuration

    Automatic loading of .env files in lerna run with the new task-runner implementation

    By default the modern task runner powered by Nx will automatically load .env files for you. You can set --load-env-files to false if you want to disable this behavior for any reason.

    For more details about what .env files will be loaded by default please see: https://nx.dev/recipes/environment-variables/define-environment-variables

    Obselete options in lerna run with the new task-runner implementation

    ... (truncated)

    Changelog

    Sourced from lerna's changelog.

    6.0.3 (2022-11-07)

    Note: Version bump only for package lerna

    6.0.2 (2022-11-02)

    Note: Version bump only for package lerna

    6.0.1 (2022-10-14)

    Bug Fixes

    • run: allow for loading of env files to be skipped (#3375) (5dbd904)

    6.0.0 (2022-10-12)

    Note: Version bump only for package lerna

    6.0.0-alpha.2 (2022-10-12)

    Bug Fixes

    6.0.0-alpha.1 (2022-10-09)

    6.0.0-alpha.0 (2022-10-07)

    Note: Version bump only for package lerna

    5.6.2 (2022-10-09)

    Note: Version bump only for package lerna

    5.6.1 (2022-09-30)

    Bug Fixes

    • add-caching: ensure lerna.json is configured automatically (9677cda)

    5.6.0 (2022-09-29)

    Features

    5.5.4 (2022-09-28)

    Note: Version bump only for package lerna

    ... (truncated)

    Commits
    Maintainer changes

    This version was pushed to npm by jameshenry, a new releaser for lerna since your current version.


    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the Security Alerts page.
    dependencies javascript 
    opened by dependabot[bot] 1
  • build(deps): bump parse-url and lerna

    build(deps): bump parse-url and lerna

    Bumps parse-url to 8.1.0 and updates ancestor dependency lerna. These dependencies need to be updated together.

    Updates parse-url from 6.0.5 to 8.1.0

    Release notes

    Sourced from parse-url's releases.

    8.1.0

    [email protected]

    • fix: cjs to load normalize-url /cc #58
    • fix: Include index.d.ts in package.json /cc #63
    • feat: support custom SSH username /cc #60
    • feat: improve regex pattern /cc #59

    Thanks to @​privatenumber and @​briancoit for their contributions! :cake:

    8.0.0

    parse-url 8.0.0

    Breaking Changes

    • The resource property will not contain the port, but the host one will.
    • Throw an error if the input is invalid. Hence, file paths like /home/path/to/dir will only be valid if the file:// protocol is added (file://home/path/to/dir)
    • Throw an error if the input length exceeds the maximum length (parse.MAX_URL_LENGTH), by default 2048.

    Fixes

    Other changes

    7.0.2

    Add the url in the error object, fixes #14

    7.0.1

    :memo: docs

    7.0.0

    parse-url 7.0.0

    :star: This is a major release of parse-url! :star:

    Breaking changes

    • If the input url has a trailing slash, the trailing slash will be added in the pathname too.
    • The port field is a string. By default empty.
    • Added the password field (default: "")
    • The resource may contain the port in it (e.g. resource: "domain.com:4200").

    Features

    • Faster
    • More secure
    • Cleaner codebase
    Commits
    • 4412976 Updated docs
    • ac17353 Merge branch 'patch-1' of github.com:briancoit/parse-url into new-version
    • 778a0a5 Merge branch 'support-custom-user' of github.com:privatenumber/parse-url into...
    • 0baab4f Merge branch 'improve-regex' of github.com:privatenumber/parse-url into new-v...
    • d1a4395 Merge branch 'fix-cjs' of github.com:privatenumber/parse-url into new-version
    • 9cacf38 :arrow_up: 8.1.0 :tada:
    • 9a78bd8 Merge pull request #61 from privatenumber/move-funding-yml
    • 1883136 Include index.d.ts in package
    • 92f899b chore: move FUNDING.yml out of workflows
    • 9500430 feat: support custom user in ssh url
    • Additional commits viewable in compare view

    Updates lerna from 4.0.0 to 6.0.3

    Release notes

    Sourced from lerna's releases.

    v6.0.3

    6.0.3 (2022-11-07)

    Bug Fixes

    • publish: support inconsistent workspace prefix usage (#3413) (da2274b)
    • version: only apply prettier if it was explicitly installed (#3406) (0161bbe)

    v6.0.2

    6.0.2 (2022-11-02)

    Bug Fixes

    • publish: remove workspace prefix on publish (#3397) (1f0e546)

    v6.0.1

    6.0.1 (2022-10-14)

    Bug Fixes

    • run: allow for loading of env files to be skipped (#3375) (5dbd904)

    v6.0.0

    6.0.0 (2022-10-12)

    Super fast, modern task-runner implementation for lerna run

    As of version 6.0.0, Lerna will now delegate the implementation details of the lerna run command to the super fast, modern task-runner (powered by Nx) by default.

    If for some reason you wish to opt in to the legacy task-runner implementation details (powered by p-map and p-queue), you can do so by setting "useNx": false in your lerna.json. (Please let us know via a Github issue if you feel the need to do that, however, as in general the new task-runner should just work how you expect it to as a lerna user).

    Interactive configurtion for lerna run caching and task pipelines via the new lerna add-caching command

    When using the modern task-runner implementation described above, the way to get the most out of it is to tell it about the outputs of your various scripts, and also any relationships that exist between them (such as needing to run the build script before the test, for example).

    Simply run lerna add-caching and follow the instructions in order to generate all the relevant configuration for your workspace.

    You can learn more about the configuration it generates here: https://lerna.js.org/docs/concepts/task-pipeline-configuration

    Automatic loading of .env files in lerna run with the new task-runner implementation

    By default the modern task runner powered by Nx will automatically load .env files for you. You can set --load-env-files to false if you want to disable this behavior for any reason.

    For more details about what .env files will be loaded by default please see: https://nx.dev/recipes/environment-variables/define-environment-variables

    Obselete options in lerna run with the new task-runner implementation

    ... (truncated)

    Changelog

    Sourced from lerna's changelog.

    6.0.3 (2022-11-07)

    Note: Version bump only for package lerna

    6.0.2 (2022-11-02)

    Note: Version bump only for package lerna

    6.0.1 (2022-10-14)

    Bug Fixes

    • run: allow for loading of env files to be skipped (#3375) (5dbd904)

    6.0.0 (2022-10-12)

    Note: Version bump only for package lerna

    6.0.0-alpha.2 (2022-10-12)

    Bug Fixes

    6.0.0-alpha.1 (2022-10-09)

    6.0.0-alpha.0 (2022-10-07)

    Note: Version bump only for package lerna

    5.6.2 (2022-10-09)

    Note: Version bump only for package lerna

    5.6.1 (2022-09-30)

    Bug Fixes

    • add-caching: ensure lerna.json is configured automatically (9677cda)

    5.6.0 (2022-09-29)

    Features

    5.5.4 (2022-09-28)

    Note: Version bump only for package lerna

    ... (truncated)

    Commits
    Maintainer changes

    This version was pushed to npm by jameshenry, a new releaser for lerna since your current version.


    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the Security Alerts page.
    dependencies javascript 
    opened by dependabot[bot] 1
Releases(4.14.2)
Owner
AXA
The AXA Group is a worldwide leader in insurance and asset management, with 171,000 employees serving 105 million clients in 61 countries.
AXA
A straightforward framework built for automatic proctoring to create online tests, effortlessly

A straightforward framework built for automatic proctoring to create online tests, effortlessly. Explore the docs » Architecture · Features · Local Se

Tushar Nankani 24 Oct 22, 2022
general natural language facilities for node

natural "Natural" is a general natural language facility for nodejs. It offers a broad range of functionalities for natural language processing. Docum

null 9.9k Nov 22, 2022
Modest natural-language processing

compromise modest natural language processing npm install compromise by Spencer Kelly and many contributors isn't it weird how we can write text, but

spencer kelly 10.4k Nov 21, 2022
Retext is a natural language processor powered by plugins part of the unified collective.

retext is a natural language processor powered by plugins part of the unified collective. Intro retext is an ecosystem of plugins for processing natur

retext 2.2k Nov 25, 2022
:robot: Natural language processing with JavaScript

classifier.js ?? An library for natural language processing with JavaScript Table of Contents Instalation Example of use Auto detection of numeric str

Nathan Firmo 90 Nov 10, 2022
Pure Javascript OCR for more than 100 Languages 📖🎉🖥

Version 2 is now available and under development in the master branch, read a story about v2: Why I refactor tesseract.js v2? Check the support/1.x br

Project Naptha 28.8k Nov 29, 2022
architecture-free neural network library for node.js and the browser

Synaptic Important: Synaptic 2.x is in stage of discussion now! Feel free to participate Synaptic is a javascript neural network library for node.js a

Juan Cazala 6.8k Nov 22, 2022
A JavaScript deep learning and reinforcement learning library.

neurojs is a JavaScript framework for deep learning in the browser. It mainly focuses on reinforcement learning, but can be used for any neural networ

Jan 4.3k Nov 28, 2022
A WebGL accelerated JavaScript library for training and deploying ML models.

TensorFlow.js TensorFlow.js is an open-source hardware-accelerated JavaScript library for training and deploying machine learning models. ⚠️ We recent

null 16.8k Nov 23, 2022
A neural network library built in JavaScript

A flexible neural network library for Node.js and the browser. Check out a live demo of a movie recommendation engine built with Mind. Features Vector

Steven Miller 1.5k Nov 11, 2022
A lightweight library for neural networks that runs anywhere

Synapses A lightweight library for neural networks that runs anywhere! Getting Started Why Sypapses? It's easy Add one dependency to your project. Wri

Dimos Michailidis 65 Nov 9, 2022
A library for prototyping realtime hand detection (bounding box), directly in the browser.

Handtrack.js View a live demo in your browser here. Handtrack.js is a library for prototyping realtime hand detection (bounding box), directly in the

Victor Dibia 2.6k Nov 22, 2022
A speech recognition library running in the browser thanks to a WebAssembly build of Vosk

A speech recognition library running in the browser thanks to a WebAssembly build of Vosk

Ciaran O'Reilly 196 Nov 26, 2022
FANN (Fast Artificial Neural Network Library) bindings for Node.js

node-fann node-fann is a FANN bindings for Node.js. FANN (Fast Artificial Neural Network Library) is a free open source neural network library, which

Alex Kocharin 186 Oct 31, 2022
machinelearn.js is a Machine Learning library written in Typescript

machinelearn.js is a Machine Learning library written in Typescript. It solves Machine Learning problems and teaches users how Machine Learning algorithms work.

machinelearn.js 518 Nov 23, 2022
Support Vector Machine (SVM) library for nodejs

node-svm Support Vector Machine (SVM) library for nodejs. Support Vector Machines Wikipedia : Support vector machines are supervised learning models t

Nicolas Panel 296 Nov 6, 2022
Machine Learning library for node.js

shaman Machine Learning library for node.js Linear Regression shaman supports both simple linear regression and multiple linear regression. It support

Luc Castera 108 Feb 26, 2021
This is a JS/TS library for accelerated tensor computation intended to be run in the browser.

TensorJS TensorJS How to use Tensors Tensor operations Reading values Data types Converting between backends Onnx model support Optimizations Running

Frithjof Winkelmann 32 Jun 26, 2022
Linear Regression library in pure Javascript

Lyric Linear Regression library in pure Javascript Lyric can help you analyze any set of x,y series data by building a model that can be used to: Crea

Flurry, Inc. 43 Dec 22, 2020