Skip to content

👽 Extract Topics ⇢ use LDA (Latent Dirichlet Allocation) to extract topics from text

Notifications You must be signed in to change notification settings

jparkerweb/extract-topics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

👽 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:

  1. Load sample text documents
  2. Apply LDA to extract the main topics
  3. 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

About

👽 Extract Topics ⇢ use LDA (Latent Dirichlet Allocation) to extract topics from text

Topics

Resources

Stars

Watchers

Forks

Sponsor this project