MaartenGr / MaartenGr/BERTopic
There are Chinese characters in my project, but after calling the visualize_document_datamap() method, the characters appear as garbled text.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.8k
- Forks
- 920
- Avg merge
- 22h 24m
- Merged PRs (30d)
- 5
Description
### Have you searched existing issues? 🔎
- [X] I have searched and found no existing issues
### Desribe the bug
fig = topic_model.visualize_document_datamap(
sentences,
topics=topics,
reduced_embeddings=reduced_embeddings,
#custom_labels=custom_labels,
title='文档和主题的分布',
sub_title='基于 BERTopic 的主题建模',
width=1200,
height=1200
)
Even after setting
plt.rcParams['font.sans-serif'] = ['SimHei'],
I still can't see the characters.
### Reproduction
```python
from bertopic import BERTopic
# with the reduced embeddings
reduced_embeddings = UMAP(n_neighbors=15, n_components=2, min_dist=0.0, metric='cosine').fit_transform(embeddings)
fig = topic_model.visualize_document_datamap(
sentences,
topics=topics,
reduced_embeddings=reduced_embeddings,
#custom_labels=custom_labels,
title='文档和主题的分布',
sub_title='基于 BERTopic 的主题建模',
width=1200,
height=1200
)
```
### BERTopic Version
0.16.4
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the BERTopic visualize_document_datamap() entry point and run the supplied reproduction with the Chinese title and subtitle. Trace how text is rendered and compare it with the attempted matplotlib font configuration. Done means Chinese characters in the visualization display correctly instead of as garbled text.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100