Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@nlpjs/basic
Advanced tools
You can install @nlpjs/basic:
npm install @nlpjs/basic
The Container is an IoC container class. Basically it's able to store instances and classes, marked as being singleton or not. When a class is registered as a singleton, a new instance is created and everytime that the container is asked for this class the same instance is returned. Same behaviour if we register an instance as singleton, but in this case this instance is returned always. When an instance is registerd as not singleton, the class of the instance is stored and when asked to the container it returns a new instance of this class.
Also in the container can be registered settings with the name of the objects registered, so these settings are provided to the new created instances.
And also pipelines can be registered. Pipelines are sequences of commands that are executed based on the classes and instances known by the container.
At the plugins folder you will find some different classes with atomics tasks:
If you take a look at the pipelines.md file you'll see this:
# Pipelines
## reverse
split
reverse
join
->output.text
## reverse-and-*
$reverse
lower
->output.text
## reverse-and-capitalize
$super
upperFirst
output.text
reverse, reverse-and-$ast and reverse-and-capitalize are pipelines. Each one contains commands to be executed in sequence. As you can see, the commands are the name of the plugins, except some exceptions:
This is the way of creating a bootstrapped container:
const { containerBootstrap } = require('@nlpjs/basic');
const container = containerBootstrap()
This automatically will:
Containers have a method runPipeline where you can pass the name of the pipeline (or the compiled pipeline) and an input to be processed. Important: this input usually travel through each step of the pipeline, so can be modified by the pipeline execution. This is an example of code calling the pipeline reverse-and-capitalize, that shows how to do inheritance of pipelines, call other pipelines, and have commands that are only executed if the depth of the call is 0 (belongs to the called pipeline).
const { containerBootstrap } = require('@nlpjs/basic');
async function main() {
const container = containerBootstrap();
const input = 'GNIHTEMOS';
const result = await container.runPipeline('reverse-and-capitalize', input);
console.log(result); // It should log "Something"
}
main();
You'll find an example of usage at examples/01-container
You can read the guide of 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 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.
FAQs
Basic dependencies for node
The npm package @nlpjs/basic receives a total of 3,832 weekly downloads. As such, @nlpjs/basic popularity was classified as popular.
We found that @nlpjs/basic demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.