Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
node-nlp-rn
Advanced tools
"NLP.js" is a general natural language utilities for nodejs. Currently supporting:
The version 3 comes with some important changes, mainly focused on improve performance:
If you're looking to use NLP.js in your node application, you can install via NPM like so:
npm install node-nlp
There is a version of NLP.js that works in React Native, so you can build chatbots that can be trained and executed in the mobile even without internet. You can install it via NPM:
npm install node-nlp-rn
Some Limitations:
You can see a great example of use at the folder /examples/console-bot
. 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 trained again.
You can start to build your NLP from scratch with few lines:
const { NlpManager } = require('node-nlp');
const manager = new NlpManager({ languages: ['en'] });
// 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 will show this result in 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' }
By default, the neural network try 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 give some weight into 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 been never seen while training. If you don't want to avoid those false positives, and you feel more confortable with classifications into the intents that you declare, then you can disable this behaviour with the useNoneFeature setting to false:
const manager = new NlpManager({ languages: ['en'], nlu: { useNoneFeature: false } });
You can also add a log progress, so you can trace what is happening during the training. You can log the progress into 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 } });
You can read the guide of how to contribute at Contributing.
You can read the Code of Conduct at Code of Conduct.
This project is developed by AXA Group Operations Spain S.A.
If you need to contact us, you can do it at the email jesus.seijas@axa.com
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.
[3.5.2] - 2019-08-20
FAQs
Library for NLU (Natural Language Understanding) done in Node.js
The npm package node-nlp-rn receives a total of 76 weekly downloads. As such, node-nlp-rn popularity was classified as not popular.
We found that node-nlp-rn demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.