Add BERTopic.

This commit is contained in:
戒酒的李白
2025-08-12 19:01:20 +08:00
parent e2323d579c
commit c5c530775e
256 changed files with 28666 additions and 0 deletions
@@ -0,0 +1,5 @@
from ._base import BaseDimensionalityReduction
__all__ = [
"BaseDimensionalityReduction",
]
@@ -0,0 +1,26 @@
import numpy as np
class BaseDimensionalityReduction:
"""The Base Dimensionality Reduction class.
You can use this to skip over the dimensionality reduction step in BERTopic.
Examples:
This will skip over the reduction step in BERTopic:
```python
from bertopic import BERTopic
from bertopic.dimensionality import BaseDimensionalityReduction
empty_reduction_model = BaseDimensionalityReduction()
topic_model = BERTopic(umap_model=empty_reduction_model)
```
"""
def fit(self, X: np.ndarray = None):
return self
def transform(self, X: np.ndarray) -> np.ndarray:
return X