Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nlpjs/console-connector

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nlpjs/console-connector - npm Package Compare versions

Comparing version 4.11.0 to 4.13.0

4

package.json
{
"name": "@nlpjs/console-connector",
"version": "4.11.0",
"version": "4.13.0",
"description": "Console Connector",

@@ -30,3 +30,3 @@ "author": {

},
"gitHead": "9b24db3f2a381399cad134bdab734e36744fcde1"
"gitHead": "926fe345330eca1a13eaaf04d0bba3631a5bba8b"
}

@@ -32,6 +32,40 @@ ![NLPjs logo](../../screenshots/nlplogo.gif)

## Example of use
## Example of use inside NLP.js
This is a little bit special component. It allows to manage scenarios where the main interface way is the console. You can find an example of use on **`examples/02-qna-classic`**.
## Example of use of the package
```javascript
const { ConsoleConnector } = require('@nlpjs/console-connector');
const connector = new ConsoleConnector();
connector.onHear = (self, text) => {
self.say(`You said "${text}"`);
};
connector.say('Say something!');
```
## Example of use with @nlpjs/basic
You must have a file _corpus.json_ in the folder of the source code:
```javascript
const { dockStart } = require('@nlpjs/basic');
(async () => {
const dockConfiguration = {
settings: {
nlp: { corpora: ['./corpus.json'] },
},
use: ['Nlp', 'ConsoleConnector']
};
const dock = await dockStart(dockConfiguration);
const nlp = dock.get('nlp');
await nlp.train();
const connector = dock.get('console');
connector.say('Say something!');
})();
```
## Contributing

@@ -38,0 +72,0 @@

@@ -44,2 +44,3 @@ /*

);
this.context = {};
this.initialize();

@@ -93,7 +94,11 @@ }

if (nlp) {
const result = await nlp.process({
message: line,
channel: 'console',
app: this.container.name,
});
const result = await nlp.process(
{
message: line,
channel: 'console',
app: this.container.name,
},
undefined,
this.context
);
this.say(result);

@@ -100,0 +105,0 @@ } else {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc