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

nlp-toolkit

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nlp-toolkit - npm Package Compare versions

Comparing version 0.2.5 to 0.2.6

lib/calculate/derivation.js

3

lib/calculate/accuracy.js

@@ -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",

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