You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

extract-topics

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

extract-topics

Extract topics from text using LDA

1.0.3
latest
Source
npmnpm
Version published
Weekly downloads
3
-25%
Maintainers
1
Weekly downloads
 
Created
Source

👽 Extract Topics

Use LDA (Latent Dirichlet Allocation) to extract topics from text

Simple NPM package for using Latent Dirichlet Allocation (LDA) for topic modeling on text inputs.

extract-topics

Install

Install dependencies:

npm install extractTopics

Usage

import { extractTopics } from 'extractTopics';

const result = await extractTopics(text, { numTopics, numTerms });

console.log(result);

API

topicExtraction(text, options)

Extracts topics from input text using LDA.

Parameters

  • text (string): The input text to analyze
  • options (object):
    • numTopics (number, optional): Number of topics to extract. Default: 2
    • numTerms (number, optional): Number of terms per topic. Default: 5

Returns

Returns a Promise that resolves to the LDA analysis result.

Example script

npm run example

The example will:

  • Load sample text documents
  • Apply LDA to extract the main topics
  • Output the discovered topics and their key terms

About LDA

LDA is an unsupervised learning method that discovers topics in text documents. It views documents as random mixtures over latent topics, where each topic is characterized by a distribution over words.

Project reference

  • https://www.npmjs.com/package/ldawithmorelanguages

Keywords

lda

FAQs

Package last updated on 05 Jun 2025

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