Version: Alpha 1.0.0
This project provides topic modelling capabilities on PDF files using two different approaches:
- Main Branch (LDA): Uses Latent Dirichlet Allocation (LDA) with Gensim for modeling and PyLDAvis for visualization
- BERT Branch: Uses BERTopic for neural-based topic discovery and representation
Both implementations support multithreading capabilities to enhance performance and efficiency. Choose the branch that best fits your use case: LDA for traditional probabilistic topic modelling, or BERTopic for state-of-the-art transformer-based topic discovery.
To get started, follow these steps:
-
Clone the Repository: Download or clone the repository to your local machine.
git clone <repository_url>
-
Python Version: Ensure you have python version 3.12 or later installed on your device.
-
Install Dependencies: Navigate to the project directory and install the required packages using pip:
pip install -r requirements.txt
-
Install NLP Library: Download the spacy language model
python -m spacy download en_core_web_sm
-
Run the Main File: Locate the main file in the project and execute it in the Python interpreter or run it directly:
python main.py
-
Select PDF Files: In the left window, choose the PDF files you wish to include from your directories. You can do this by double-clicking or pressing Enter.
-
Adjust Parameters: In the top right section, adjust the LDA parameters. Only modify these settings if you are knowledgeable about them, as proper error handling for incorrect configurations is not yet implemented.
-
Set Output Directory: Specify the directory where you want to save the output files (e.g., for macOS:
/Users/<user>/Desktop). -
View Selected PDFs: The bottom panel displays the selected PDF files.
-
Start Processing: Click the "Start" button to create one LDA model for all the selected files.
-
Clear Selection: Click "Clear" to remove all files and create a new LDA model.
-
Multithreading: The application supports parallel processing. After clicking "Start," you can immediately click "Clear," select a new batch of files, and click "Start" again. The number of output files will correspond to the number of batches processed.
- The progress bar currently has some bugs; it only reflects the progress of reading the files.
- The visualization process may take some time. If you click "Start" and the console or GUI does not display any errors (Warnings, Critical errors, or General Errors), the process is likely running smoothly.
The main branch implements classical Latent Dirichlet Allocation using Gensim. This approach is well-established, interpretable, and works well for traditional topic modelling tasks. Use this branch if you prefer probabilistic topic models with clear hyperparameter control.
The BERT branch implements BERTopic, a modern topic modelling technique that leverages transformer-based language models (BERT) for semantic understanding. BERTopic offers several advantages:
- Semantic awareness: Captures semantic meaning through pre-trained transformers
- Automatic topic discovery: Reduces need for manual parameter tuning
- Neural embeddings: Uses contextual embeddings rather than bag-of-words representations
- Flexible clustering: Employs density-based clustering (HDBSCAN) for more natural topic grouping
To use the BERT branch, checkout with:
git checkout bertBoth branches share the same GUI and input pipeline, so switching between them is straightforward. The output format and visualization may differ slightly due to the different underlying algorithms.