tessl install tessl/pypi-gensim@4.3.0Python library for topic modelling, document indexing and similarity retrieval with large corpora
Agent Success
Agent success rate when using this tile
78%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.03x
Baseline
Agent success rate without this tile
76%
Build a lightweight pipeline that turns raw text into a trained topic model, exposes human-readable topics, and supports inference and persistence.
@generates
from typing import Iterable, List, Tuple
class TopicPipeline:
def __init__(self, stopwords: Iterable[str] | None = None):
...
def train(self, texts: Iterable[str], num_topics: int, passes: int = 5) -> None:
"""Builds vocabulary and fits the topic model."""
def infer(self, text: str) -> List[Tuple[int, float]]:
"""Returns topic-probability pairs ordered by highest probability."""
def top_terms(self, topic_id: int, topn: int = 10) -> List[Tuple[str, float]]:
"""Returns the most probable terms for a topic."""
def save(self, path: str) -> None:
"""Persists model artifacts to a directory."""
@classmethod
def load(cls, path: str) -> "TopicPipeline":
"""Restores a previously saved pipeline."""Topic modeling and corpus streaming utilities. @satisfied-by