Gathering detailed insights and metrics for @nlpjs/lang-ja
Gathering detailed insights and metrics for @nlpjs/lang-ja
Gathering detailed insights and metrics for @nlpjs/lang-ja
Gathering detailed insights and metrics for @nlpjs/lang-ja
npm install @nlpjs/lang-ja
Typescript
Module System
Node Version
NPM Version
80.6
Supply Chain
67.7
Quality
87.7
Maintenance
100
Vulnerability
98.9
License
JavaScript (99.86%)
WebAssembly (0.08%)
CSS (0.05%)
HTML (0.02%)
Total Downloads
1,672,037
Last Day
552
Last Week
4,348
Last Month
29,244
Last Year
415,419
6,307 Stars
2,446 Commits
622 Forks
111 Watching
37 Branches
68 Contributors
Minified
Minified + Gzipped
Latest Version
5.0.0-alpha.4
Package Id
@nlpjs/lang-ja@5.0.0-alpha.4
Unpacked Size
79.60 kB
Size
21.06 kB
File Count
14
NPM Version
lerna/8.1.9/node@v22.11.0+arm64 (darwin)
Node Version
22.11.0
Publised On
18 Dec 2024
Cumulative downloads
Total Downloads
Last day
-59.3%
552
Compared to previous day
Last week
-43.3%
4,348
Compared to previous week
Last month
-17.5%
29,244
Compared to previous month
Last year
1.5%
415,419
Compared to previous year
2
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:
!
Version 4 is very different from previous versions. Before this version, NLP.js was a monolithic library. The big changes:
normalize -> tokenize -> removeStopwords -> stem -> arrToObj
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).If you're looking to use NLP.js in your Node application, you can install via NPM like so:
1 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 on the mobile even without the internet. You can install it via NPM:
1 npm install node-nlp-rn
Some limitations:
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:
1const { NlpManager } = require('node-nlp'); 2 3const manager = new NlpManager({ languages: ['en'], forceNER: true }); 4// Adds the utterances and intents for the NLP 5manager.addDocument('en', 'goodbye for now', 'greetings.bye'); 6manager.addDocument('en', 'bye bye take care', 'greetings.bye'); 7manager.addDocument('en', 'okay see you later', 'greetings.bye'); 8manager.addDocument('en', 'bye for now', 'greetings.bye'); 9manager.addDocument('en', 'i must go', 'greetings.bye'); 10manager.addDocument('en', 'hello', 'greetings.hello'); 11manager.addDocument('en', 'hi', 'greetings.hello'); 12manager.addDocument('en', 'howdy', 'greetings.hello'); 13 14// Train also the NLG 15manager.addAnswer('en', 'greetings.bye', 'Till next time'); 16manager.addAnswer('en', 'greetings.bye', 'see you soon!'); 17manager.addAnswer('en', 'greetings.hello', 'Hey there!'); 18manager.addAnswer('en', 'greetings.hello', 'Greetings!'); 19 20// Train and save the model. 21(async() => { 22 await manager.train(); 23 manager.save(); 24 const response = await manager.process('en', 'I should go now'); 25 console.log(response); 26})();
This produces the following result in a console:
1{ utterance: 'I should go now', 2 locale: 'en', 3 languageGuessed: false, 4 localeIso2: 'en', 5 language: 'English', 6 domain: 'default', 7 classifications: 8 [ { label: 'greetings.bye', value: 0.698219120207268 }, 9 { label: 'None', value: 0.30178087979273216 }, 10 { label: 'greetings.hello', value: 0 } ], 11 intent: 'greetings.bye', 12 score: 0.698219120207268, 13 entities: 14 [ { start: 12, 15 end: 14, 16 len: 3, 17 accuracy: 0.95, 18 sourceText: 'now', 19 utteranceText: 'now', 20 entity: 'datetime', 21 resolution: [Object] } ], 22 sentiment: 23 { score: 1, 24 comparative: 0.25, 25 vote: 'positive', 26 numWords: 4, 27 numHits: 2, 28 type: 'senticon', 29 language: 'en' }, 30 actions: [], 31 srcAnswer: 'Till next time', 32 answer: 'Till next time' }
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:
1const 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 to the console:
1const nlpManager = new NlpManager({ languages: ['en'], nlu: { log: true } });
Or you can provide your own log function:
1const logfn = (status, time) => console.log(status, time); 2const nlpManager = new NlpManager({ languages: ['en'], nlu: { log: logfn } });
You can read the guide for how to contribute at Contributing.
Made with contributors-img.
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 opensource@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.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
binaries present in source code
Details
Reason
Found 7/13 approved changesets -- score normalized to 5
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
project is not fuzzed
Details
Reason
46 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-12-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More