【乾貨推薦] 基於Bert的聚類工具:BERTopic
【簡介】:BERTopic是一種主題建模技術,它利用🤗變換器和c-TF-IDF創建聚類簇,使主題易於理解,同時在主題描述中保留重要的單詞。 同時可以支持類似於LDAvis的可視化。
【快速上手】 安裝pip install bertopic[visualization]
from bertopic import BERTopic
from sklearn.datasets import fetch_20newsgroups
docs = fetch_20newsgroups(subset='all', remove=('headers', 'footers', 'quotes'))['data']
topic_model = BERTopic()
topics, _ = topic_model.fit_transform(docs)
【官網鏈接】:GitHub鏈接爲https://github.com/MaartenGr/BERTopic,官方文檔https://maartengr.github.io/BERTopic/index.html