New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

natural-content

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

natural-content - npm Package Compare versions

Comparing version 1.0.14 to 1.0.15

6

index.js

@@ -122,3 +122,3 @@ const { PorterStemmerFr, TfIdf, AggressiveTokenizerFr } = require('natural');

*/
function getWords(text, withStopWords, language) {
function getWords(text, withStopWords = false, language = 'fr') {
const words = text.replace(/[\n\r]/g, WORD_SEPARATOR) // Convert end of line

@@ -183,3 +183,3 @@ .replace(/[\t]/g, WORD_SEPARATOR) // Remove Tabs

*/
function getTopKeywords(documents, nbrKeywords) {
function getTopKeywords(documents, nbrKeywords, language = 'fr') {
PorterStemmerFr.attach();

@@ -189,3 +189,3 @@

documents.forEach((d) => tfidf.addDocument(d.tokenizeAndStem()));
documents.forEach((d) => tfidf.addDocument(getWords(d, false, language)));

@@ -192,0 +192,0 @@ // Get the 2 first main terms from the stems

{
"name": "natural-content",
"version": "1.0.14",
"version": "1.0.15",
"description": "A set of natural functions like tf.idf, extract words & n-grams, remove diacritics, ... (experimental project)",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -27,3 +27,3 @@ const assert = require('assert');

it('top keywords', () => {
const stats = natural.getTopKeywords([ 'word1 word2 word3 word4 word1 word6 word1 word2 word2 word1 word2 word2 word2 word2' ], 2);
const stats = natural.getTopKeywords([ 'word1 du word2 du word3 du word4 word1 du word6 du word1 du word2 du word2 du word1 word2 word2 word2 word2' ], 2);

@@ -30,0 +30,0 @@ assert(stats.length === 2);

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