@hiyurigi/nlp
v2.0.0-alpha.3
Published
NLP in js/es
Downloads
63
Readme
NLP by Hiyurigi
A simple implementation of NLP in JS.
How to use
Installation
npm i @hiyurigi/nlpFunction
- Text Correction
Example:
const NLP = require('@hiyurigi/nlp')("TextCorrection"); let v = new NLP(["stats", "menu", "xzxz"]); let result = v.TextCorrection({Needle: "mqnts", Threshold: 0.4, NgramsLength: 1}); console.log(result);Output:
|Parameter|Description|Type|Default| |---------|-----------|----|-------| |Needle| Text you want to fix.| String | Required | None | |NgramsLength| how many grams you want.| integer | Optional| 1 | |Threshold| Text correction threshold.| float | Optional| 0.3 | |ThresholdOperator| Threshold js comparison operator.| String | Optional| >= | |KeyRange| Key distance on the keyboard.| Integer | Optional | 2 | |Autofix| Auto fix word (works only with NgramsLength = 1). | Boolean | Optional | true | |RemoveArray| Remove array when output just 1. | Boolean | Optional | false |[ { Key: 'menu', Text: [ 'm', 'e', 'n', 'u'], similarity: 1 }, { Key: 'stats', Text: [ 'm', 'q', 'n', 't', 's' ], similarity: 0.4 } ] - Text Completion
Example:
const NLP = require('@hiyurigi/nlp')("TextCompletion"); let v = new NLP(["stats", "menu", "xzxz"]); let result = v.TextCompletion("m"); console.log(result);Output:
|Parameter|Description|Type|Default| |---------|-----------|----|-------| |UncompleteText| Uncompleted Text.|String | Required|Nonemenu
Testing
npm testTODO List
- [x] Create text correction
- [x] Create text completion
If you have a Idea feel free to suggest me
License
License - GNU GPLv3
