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

@nlpjs/utils

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nlpjs/utils - npm Package Compare versions

Comparing version 4.17.7 to 4.17.8

4

package.json
{
"name": "@nlpjs/utils",
"version": "4.17.7",
"version": "4.17.8",
"description": "NLP utils",

@@ -30,3 +30,3 @@ "author": {

},
"gitHead": "1d2f085cfcef0c8671b45e0dd4705da94bd56621",
"gitHead": "2986658b5f578ff2ec45488204a3ef8e9535d427",
"dependencies": {

@@ -33,0 +33,0 @@ "@nlpjs/xtables": "^4.17.0",

@@ -0,0 +0,0 @@ /*

@@ -39,3 +39,3 @@ /*

};
const vowels = { a: 1, e: 1, i: 1, o: 1, u: 1 };
const vowels = { a: 1, e: 1, i: 1, o: 1, u: 1, y: 1 };
const chars = {};

@@ -59,2 +59,4 @@ for (let i = 0; i < tokens.length; i += 1) {

freqs.wordCharFreq = freqs.words / freqs.length;
freqs.vowelOverConsonant =
freqs.consonants > 0 ? freqs.vowels / freqs.consonants : 0;
return freqs;

@@ -74,2 +76,5 @@ }

function gibberishScore(text) {
if (text.length < 6) {
return 0;
}
const tokens = normalize(text)

@@ -80,14 +85,9 @@ .split(/[\s,.!?;:([\]'"¡¿)/]+/)

const deviations = {
wordChar: getDeviation(measures.wordCharFreq, 0.15, 0.25),
vowel: getDeviation(measures.vowelFreq, 0.3, 0.45),
unique: getDeviation(measures.uniqueFreq, 0.4, 0.55),
consonant: getDeviation(measures.consonantFreq, 0.5, 0.7),
wordChar: getDeviation(measures.wordCharFreq, 0.15, 0.3),
unique: getDeviation(measures.uniqueFreq, 0.4, 1),
vowelOverConsonant: getDeviation(measures.vowelOverConsonant, 0.5, 1.5),
};
return Math.min(
1,
(deviations.wordChar +
deviations.vowel +
deviations.unique +
deviations.consonant) /
2
deviations.unique * 2 + deviations.wordChar + deviations.vowelOverConsonant
);

@@ -94,0 +94,0 @@ }

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