dual-wordcloud
Venn diagram–style wordcloud that splits keywords across three regions: left-only, shared (center), and right-only.
Installation
pip install dual-wordcloud
Usage
Mode 1: Direct regions (from_regions)
Use when you already have keywords pre-divided into three groups — e.g. positive / neutral / negative sentiment.
from collections import Counter
from dual_wordcloud import DualWordCloud
positive = Counter({"성장": 42, "혁신": 35, "안정": 28})
neutral = Counter({"금리": 20, "실적": 18})
negative = Counter({"손실": 30, "위기": 25, "부채": 15})
dwc = DualWordCloud.from_regions(
left=positive,
center=neutral,
right=negative,
left_label="긍정",
right_label="부정",
left_border_color="#3498db",
right_border_color="#e74c3c",
)
dwc.to_file("sentiment.png")
Mode 2: Comparison (from_comparison)
Use when you have two raw keyword counters and want to compare them. Keyword placement (left / center / right) is determined automatically by normalized frequency ratio.
from collections import Counter
from dual_wordcloud import DualWordCloud
bnk = Counter({"대출": 120, "금리": 95, "부채": 40, "성장": 60})
hana = Counter({"예금": 110, "금리": 88, "투자": 75, "성장": 58})
dwc = DualWordCloud.from_comparison(
left=bnk,
right=hana,
count_left=1000, # total articles for BNK (for normalization)
count_right=850, # total articles for Hana
left_label="BNK",
right_label="하나",
)
dwc.to_file("comparison.png")
Keywords that appear predominantly in one source land in that source's circle. Keywords with similar frequency in both land in the center intersection.
Output
dwc.to_file("output.png") # save PNG, returns Path
dwc.to_image() # PIL Image (for further processing)
dwc.show() # open in system viewer
dwc # inline display in Jupyter Notebook
Parameters
from_regions(left, center, right, **kwargs)
| Parameter | Type | Default | Description |
|---|---|---|---|
left |
Counter[str] |
required | Left circle keywords |
center |
Counter[str] |
required | Intersection keywords |
right |
Counter[str] |
required | Right circle keywords |
left_label |
str |
"Left" |
Left circle label |
right_label |
str |
"Right" |
Right circle label |
word_colors |
dict[str, str] | None |
None |
Per-word hex colors (highest priority) |
colormap |
str | None |
None |
matplotlib colormap name (e.g. "Reds") |
font_path |
str | Path | None |
None |
Font file path. Auto-detected if None |
left_border_color |
str |
"#2980b9" |
Left circle border color |
right_border_color |
str |
"#e74c3c" |
Right circle border color |
left_word_color |
str |
"#2980b9" |
Left region word fallback color |
right_word_color |
str |
"#e74c3c" |
Right region word fallback color |
center_word_color |
str |
"#95a5a6" |
Center region word fallback color |
quality_scale |
int |
2 |
Render quality 1–3 |
from_comparison(left, right, count_left, count_right, **kwargs)
Same as from_regions plus:
| Parameter | Type | Default | Description |
|---|---|---|---|
count_left |
int |
required | Total document count for left (normalization denominator) |
count_right |
int |
required | Total document count for right |
ratio_threshold |
float |
2.0 |
Frequency ratio above which a keyword is placed exclusively in one circle |
Word color priority
word_colors[keyword] → per-word color (highest)
colormap → matplotlib colormap
*_word_color → region fallback color (lowest)
Korean font
The renderer auto-detects common Korean system fonts (AppleSDGothicNeo, NanumGothic, Malgun Gothic). To use a specific font:
dwc = DualWordCloud.from_regions(
...,
font_path="/path/to/NanumGothic.ttf",
)
Requirements
- Python 3.12+
- matplotlib, matplotlib-venn, wordcloud, shapely, Pillow, numpy
Metadata
Release files for dual-wordcloud 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dual_wordcloud-0.1.0.tar.gz | 57.9 kB | Without provenance | Details for dual_wordcloud-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dual_wordcloud-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for dual_wordcloud-0.1.0-py3-none-any.whl |
Total release size: 65.4 kB
Release files / dual_wordcloud-0.1.0.tar.gz
| Download URL | dual_wordcloud-0.1.0.tar.gz |
|---|---|
| Size | 57.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9670d461a335979df6b546b6c9365dd890f8a4d7db07de5f75d047c7ea552017
|
|
BLAKE2b-256 checksum How to use checksums |
a2a2050a40043114a6484a841ce5ec8848dd31686f08c3a3e0a7592e745ba3f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / dual_wordcloud-0.1.0-py3-none-any.whl
| Download URL | dual_wordcloud-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
67f0bc01a6d4040c41315ea44ad16f989aea3d46b80340a072bf620c6191d30a
|
|
BLAKE2b-256 checksum How to use checksums |
8ae93f683feab02e7c044f507dec7996da0b3fb6ea427e932c3c8f13f145c9dc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for dual-wordcloud 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.