Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
text-keyword-extractor
Advanced tools
Extract keywords from text content with various processing options.
# Text Keyword Extractor
A Node.js package for extracting keywords from text content. This package identifies proper nouns, high-frequency words, and contextual keywords from both content and titles while filtering out common stop words.
## Features
- Proper noun extraction (including compound names and terms with numbers)
- High-frequency keyword identification
- Context extraction from titles
- Stop words filtering
- Support for multi-word phrases
- Customizable frequency threshold
## Installation
```bash
npm install text-keyword-extractor
const { KeywordExtractor } = require('text-keyword-extractor');
// Initialize with content and optional title
const content = `Google and Microsoft announced new AI features.
OpenAI's ChatGPT continues to evolve.
Apple and Amazon are also investing in AI technology.`;
const title = "Tech Giants Announce AI Features";
const extractor = new KeywordExtractor(content, title);
const keywords = extractor.extractKeywords();
console.log(keywords);
// Output: ["OpenAI ChatGPT", "Google", "Microsoft", "Apple", "Amazon", "AI", "Tech Giants"]
const { KeywordExtractor } = require('text-keyword-extractor');
const content = "Microsoft and Google are working with OpenAI.";
const extractor = new KeywordExtractor(content);
const properNouns = extractor.findProperNouns();
console.log(properNouns);
// Output: ["Microsoft", "Google", "OpenAI"]
const extractor = new KeywordExtractor(content);
const frequentWords = extractor.findHighFrequencyKeywords(5); // Get top 5 keywords
console.log(frequentWords);
// Output: [
// { word: "AI", frequency: 3 },
// { word: "technology", frequency: 2 }
// ]
const extractor = new KeywordExtractor(content, "Breaking: ChatGPT Launches New Features");
const titleContext = extractor.findContextFromTitle();
console.log(titleContext);
// Output: ["ChatGPT", "Features"]
You can also use individual utility functions without creating an instance:
const { utilities } = require('text-keyword-extractor');
// Remove stop words from array
const cleaned = utilities.removeStopWords(["The", "quick", "brown", "fox"]);
console.log(cleaned); // ["quick", "brown", "fox"]
// Find proper nouns in text
const properNouns = utilities.findProperNouns("Google and Microsoft announced new features");
console.log(properNouns); // ["Google", "Microsoft"]
// Get frequent keywords
const frequent = utilities.findHighFrequencyKeywords(content, 5);
console.log(frequent); // Returns top 5 frequent words with their counts
const extractor = new KeywordExtractor(content, title);
content
(string): The text content to analyzetitle
(string, optional): Additional title for contextReturns an array of extracted keywords after processing all available methods.
Extracts proper nouns from the content. Identifies:
Returns top N frequent keywords with their frequency counts.
N
(number, default: 7): Number of keywords to returnExtracts relevant keywords from the title after removing stop words.
Removes common stop words from an array of tokens.
tokens
(string[]): Array of words to processMIT
FAQs
Extract keywords from text content
The npm package text-keyword-extractor receives a total of 3 weekly downloads. As such, text-keyword-extractor popularity was classified as not popular.
We found that text-keyword-extractor demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.