Metadata-Version: 2.4
Name: graphtopic
Version: 0.0.1
Summary: Graph-based topic modeling using semantic graphs
Author: Mohsen Sahrayi
License: MIT
Project-URL: Homepage, https://github.com/sahrayi/graphtopic
Project-URL: Repository, https://github.com/sahrayi/graphtopic
Project-URL: Issues, https://github.com/sahrayi/graphtopic/issues
Keywords: topic-modeling,graph,nlp,embeddings,community-detection
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: License :: OSI Approved :: MIT License
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.24
Requires-Dist: scikit-learn>=1.3
Requires-Dist: graphion>=0.0.1
Requires-Dist: sentence-transformers>=3.0
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: pytest-cov>=5.0; extra == "dev"
Provides-Extra: embedding
Dynamic: license-file

# GraphTopic

**Graph-based topic modeling built on semantic graphs.**

GraphTopic is a Python library for discovering document topics using graph-based community detection instead of traditional clustering algorithms.

It is built on top of **Graphion**, a modular graph processing framework, allowing every stage of the topic modeling pipeline to be customized.

---

## Features

- Graph-based topic discovery
- Pluggable embedding models
- Pluggable graph construction
- Pluggable community detection
- Pluggable topic representation
- Simple sklearn-like API
- Built on Graphion

---

## Installation

Install the core library:

```bash
pip install graphtopic
```

To use the built-in SentenceTransformer embedding model:

```bash
pip install "graphtopic[embedding]"
```

---

## Quick Start

```python
from graphtopic import GraphTopic
from graphtopic.embedding_models import (
    SentenceTransformerEmbedding,
)

documents = [
    "Apple released a new iPhone.",
    "Samsung announced a new Galaxy phone.",
    "Barcelona won the football match.",
    "Real Madrid signed a new player.",
]

model = GraphTopic(
    embedding_model=SentenceTransformerEmbedding(
        "sentence-transformers/all-MiniLM-L6-v2"
    )
)

topics = model.fit_transform(documents)

for topic in model.get_topic_info():
    print(topic)
```

---

## Pipeline

GraphTopic follows a modular processing pipeline:

```

Documents
↓
Embeddings
↓
FeatureSet
↓
Relation Graph
↓
Community Detection
↓
Topic Representation
↓
Topic Information

```

Each stage can be replaced with custom implementations.

---

## Custom Components

GraphTopic is designed around interchangeable components.

You can replace:

- Embedding Model
- Reducer
- Relation Builder
- Graph Builder
- Graph Refiner
- Community Detector
- Partition Refiner
- Representation Model

This makes it easy to experiment with different graph construction and topic discovery strategies.

---

## Built on Graphion

GraphTopic uses Graphion as its graph processing backend.

Graphion provides reusable components for:

- similarity computation
- graph construction
- graph refinement
- community detection
- graph processing pipelines

GraphTopic focuses only on topic modeling while delegating graph operations to Graphion.

---

## Requirements

- Python 3.11+
- NumPy
- scikit-learn
- Graphion

---

## Project Status

GraphTopic is currently in **Pre-Alpha (0.0.x)**.

The public API is expected to evolve as new functionality is added.

---

## License

MIT License
