Socket
Socket
Sign inDemoInstall

whichx

Package Overview
Dependencies
0
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.2 to 2.1.3

12

assets/scripts/whichx.js

@@ -11,3 +11,3 @@ // Defining the Whichx object.

// Total must exist and be incremented for probability calculations.
"total": { "tcount": 0, "wordTotal": 0 }
"total": { "tcount": 0, "wordTotal": 1 }
};

@@ -38,4 +38,4 @@

if (label in typesMap && typeof description === "string") {
type = typesMap[label];
if (label.toLowerCase() in typesMap && typeof description === "string") {
type = typesMap[label.toLowerCase()];
type.tcount = type.tcount + 1;

@@ -75,4 +75,4 @@ total.tcount = total.tcount + 1;

wordArray = processToArray(description);
bestChance = 0;
bestLabel = "pet";
bestChance = -1;
bestLabel = undefined;

@@ -98,3 +98,3 @@ // Loop through types working out the chance of the description being

// Exports the WhichX internal data representation learned from provided
// labeled text. Please see th typesMap comments for more details.
// labeled text. Please see the typesMap comments for more details.
this.export = function() {

@@ -101,0 +101,0 @@ return typesMap;

{
"name": "whichx",
"version": "2.1.2",
"version": "2.1.3",
"description": "A text description classifier for classifying arbitrary strings into provided labels",

@@ -5,0 +5,0 @@ "main": "assets/scripts/whichx.js",

@@ -48,2 +48,6 @@ (function(){

});
it("object should have default classify value", function() {
assert.equal(classifier.classify("no labels"), undefined);
});
});

@@ -118,2 +122,9 @@

classificationAssertions(classifier);
it("should successfully classify with only 1 label", function() {
classifier = new Whichx();
classifier.addLabels("pokemon");
classifier.addData("pokemon", "pikachu yellow lightning");
assert.equal(classifier.classify("pokemanz?"), "pokemon");
});
});

@@ -120,0 +131,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc