Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yoctol/yoctol-nlu-node
Yoctol Natural Language Understanding SDK for Node.js
https://github.com/yoctol/yoctol-nlu-node
natural-language-understanding nlu
Last synced: about 2 months ago
JSON representation
Yoctol Natural Language Understanding SDK for Node.js
- Host: GitHub
- URL: https://github.com/yoctol/yoctol-nlu-node
- Owner: Yoctol
- Created: 2017-06-02T04:12:34.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-03T18:43:32.000Z (about 2 years ago)
- Last Synced: 2024-10-30T07:27:06.359Z (2 months ago)
- Topics: natural-language-understanding, nlu
- Language: JavaScript
- Homepage:
- Size: 1.44 MB
- Stars: 2
- Watchers: 11
- Forks: 3
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# yoctol-nlu-node
Yoctol Natural Language Understanding SDK for Node.js
## Install
```sh
$ npm install ynlu
```or using yarn:
```sh
$ yarn add ynlu
```## Usage
```js
const { Client } = require('ynlu');// put your token into client
const client = Client.connect(process.env.TOKEN);async function train() {
const classifier = client.findClassifierById('...');
const result = await classifier.train();
}async function predict() {
const classifier = client.findClassifierById('...');
// the second parameter is Boolean, represent exactly match or not
// default to true
const result1 = await classifier.predict('買給我好不好'); // exactly match = true
const result2 = await classifier.predict('買給我好不好', true);
const result3 = await classifier.predict('買給我好嗎', false);
}async function extract() {
const extractor = client.findExtractorById('...');const entities = await extractor.extract('買給我好不好');
}
```### Options
#### Customize endpoint
```js
const { Client } = require('ynlu');const client = Client.connect(
process.env.TOKEN,
{ endpoint: 'https://some.domain/graphql' }
);
```