@nlpjs/nlu
Advanced tools
Comparing version 4.8.1 to 4.9.0
{ | ||
"name": "@nlpjs/nlu", | ||
"version": "4.8.1", | ||
"version": "4.9.0", | ||
"description": "Natural Language Understanding", | ||
@@ -30,6 +30,6 @@ "author": { | ||
"@nlpjs/language-min": "^4.6.0", | ||
"@nlpjs/neural": "^4.8.1", | ||
"@nlpjs/neural": "^4.9.0", | ||
"@nlpjs/similarity": "^4.0.0-rc.4" | ||
}, | ||
"gitHead": "290e87216eabbd99569a17c1f5a890ade09c1e44" | ||
"gitHead": "4d1bbc367e7488a4bf34973f2b4444978857493e" | ||
} |
@@ -24,10 +24,3 @@ /* | ||
let NeuralNetwork; | ||
try { | ||
// eslint-disable-next-line | ||
NeuralNetwork = require('@nlpjs/neural-worker').NeuralNetwork; | ||
} catch (err) { | ||
// eslint-disable-next-line | ||
NeuralNetwork = require('@nlpjs/neural').NeuralNetwork; | ||
} | ||
const { NeuralNetwork } = require('@nlpjs/neural'); | ||
const Nlu = require('./nlu'); | ||
@@ -43,23 +36,9 @@ | ||
getBestIntent(classifications) { | ||
let best; | ||
let bestClassification = 0; | ||
const keys = Object.keys(classifications); | ||
for (let i = 0; i < keys.length; i += 1) { | ||
if (classifications[keys[i]] > bestClassification) { | ||
best = keys[i]; | ||
bestClassification = classifications[keys[i]]; | ||
} | ||
} | ||
return best; | ||
} | ||
innerProcess(srcInput) { | ||
const input = srcInput; | ||
if (!this.neuralNetwork) { | ||
input.classifications = { None: 1 }; | ||
} else { | ||
input.classifications = this.neuralNetwork.run(input.tokens); | ||
} | ||
const intent = this.getBestIntent(input.classifications); | ||
input.classifications = this.neuralNetwork | ||
? this.neuralNetwork.run(input.tokens) | ||
: { None: 1 }; | ||
this.convertToArray(input); | ||
const { intent } = input.classifications[0]; | ||
if ( | ||
@@ -66,0 +45,0 @@ input.settings && |
@@ -93,3 +93,2 @@ /* | ||
'.innerProcess', | ||
'.convertToArray', | ||
'.filterNonActivated', | ||
@@ -96,0 +95,0 @@ '.normalizeClassifications', |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43391
1278
Updated@nlpjs/neural@^4.9.0