🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

density-detection

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

density-detection

This library analyzes the words and phrases in a text and presents the most repetitive words and phrases with the number of repetitions. The difference from other libraries is that it focuses on words and phrases, not words.

latest
Source
npmnpm
Version
1.2.0
Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

Density Detection

This library allows you to detect content density. It thoroughly analyzes a string you send and returns the most used words and phrases with the usage count and length variables.

npm i density-detection
const detector = require("density-detection");
var check = detector.detect({
    text:`<text>`,
    start_index:1 // not mandatory default 1
})
console.log(check)

text: The content to be checked must be sent to the function in the text variable.

start_index: Repetitive word groups are searched in the content by dividing them into parts as 1, 2, 3 in order. You can use this variable to determine how many parts to start checking. For example, if it is not important how many times groups of 1 word occur in the content, you can send this variable as 2. If 2 is sent, it starts checking by dividing into groups of 2. It continues the check by dividing into groups of 2, 3, 4, 5 words.

Sample Response

[
  { item: "Norton's theorem", count: 2, parseCount: 2 },
  { item: "Norton's", count: 2, parseCount: 1 },
  { item: 'a', count: 20, parseCount: 1 },
  { item: 'in', count: 5, parseCount: 1 },
  { item: 'the', count: 5, parseCount: 1 },
  { item: 'analysis', count: 2, parseCount: 1 },
  { item: 'of', count: 2, parseCount: 1 },
]

The start_index variable is not sent in this query. If it was sent as 2, it would return an array with only 1 variable.

item: This variable returns multiple occurrences within the content.

count: This variable returns the number of times the fragment is used in the content.

parseCount: This variable returns how many words the fragment consists of.

Keywords

word

FAQs

Package last updated on 03 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts