nlp-toolkit
Advanced tools
Comparing version 0.2.5 to 0.2.6
@@ -30,3 +30,4 @@ /** | ||
p.total += 1; | ||
if (c.guess === c.feature) { | ||
var guess = c.guess.category || c.guess; | ||
if (guess === c.feature) { | ||
p.positive += 1; | ||
@@ -33,0 +34,0 @@ } else { |
@@ -42,7 +42,8 @@ /** | ||
p[c.feature].total += 1; | ||
if (c.guess === c.feature) { | ||
var guess = c.guess.category || c.guess; | ||
if (guess === c.feature) { | ||
p[c.feature].positive += 1; | ||
} else { | ||
if (!p[c.guess]) { | ||
p[c.guess] = { | ||
if (!p[guess]) { | ||
p[guess] = { | ||
total: 0, | ||
@@ -53,3 +54,3 @@ positive: 0, | ||
} | ||
p[c.guess].negative += 1; | ||
p[guess].negative += 1; | ||
} | ||
@@ -56,0 +57,0 @@ return p; |
module.exports.accuracy = require('./accuracy.js'); | ||
module.exports.derivation = require('./derivation.js'); | ||
module.exports.texts = require('./texts.js'); | ||
module.exports.features = require('./features.js'); |
@@ -12,3 +12,3 @@ /** | ||
*/ | ||
var bayes = require('bayes'); | ||
var bayes = require('bayes_fixed'); | ||
@@ -15,0 +15,0 @@ |
@@ -14,2 +14,3 @@ /** | ||
var debug = require('debug')('divide'); | ||
var _ = require('lodash'); | ||
@@ -24,3 +25,5 @@ | ||
var sets = options.sets || [1, 1]; | ||
var slots = new Array(sets.reduce(function(pv, cv) { return pv + cv; }, 0)); | ||
var maxItems = +options.maxItems; | ||
var numSlots = sets.reduce(function(pv, cv) { return pv + cv; }, 0); | ||
var slots = new Array(numSlots); | ||
@@ -39,2 +42,16 @@ debug('sets', sets); | ||
}, function (callback) { | ||
if (maxItems) { | ||
maxItems = maxItems / numSlots; | ||
slots = slots.map(function (slot) { | ||
var _slot = _.shuffle(slot); | ||
var _featureCounter = {}; | ||
return _slot.filter(function (item) { | ||
if (!_featureCounter.hasOwnProperty(item.feature)) { | ||
_featureCounter[item.feature] = 0; | ||
} | ||
_featureCounter[item.feature] += 1; | ||
return (_featureCounter[item.feature] <= maxItems); | ||
}); | ||
}); | ||
} | ||
this.push(slots); | ||
@@ -41,0 +58,0 @@ return callback(); |
@@ -15,6 +15,8 @@ { | ||
"dependencies": { | ||
"bayes": "0.0.4", | ||
"bayes_fixed": "0.0.6", | ||
"bluebird": "^3.3.4", | ||
"debug": "^2.2.0", | ||
"event-stream": "^3.3.2", | ||
"lodash": "^4.11.1", | ||
"mathjs": "^3.1.4", | ||
"snowball-stemmer.jsx": "^0.2.3", | ||
@@ -27,3 +29,3 @@ "through2": "^2.0.1" | ||
}, | ||
"version": "0.2.5", | ||
"version": "0.2.6", | ||
"keywords": [ | ||
@@ -30,0 +32,0 @@ "nlp", |
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
768263
53
1296
8
+ Addedbayes_fixed@0.0.6
+ Addedlodash@^4.11.1
+ Addedmathjs@^3.1.4
+ Addedbayes_fixed@0.0.6(transitive)
+ Addedcomplex.js@2.0.4(transitive)
+ Addeddecimal.js@9.0.1(transitive)
+ Addedescape-latex@1.2.0(transitive)
+ Addedfraction.js@4.0.4(transitive)
+ Addedjavascript-natural-sort@0.7.1(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedmathjs@3.20.2(transitive)
+ Addedseed-random@2.2.0(transitive)
+ Addedtiny-emitter@2.0.2(transitive)
+ Addedtyped-function@0.10.7(transitive)
- Removedbayes@0.0.4
- Removedbayes@0.0.4(transitive)