| |
| """Beautiful LinkedIn teaser card for the open-licensed Polish token dataset. |
| Vague on provenance: shows totals + domain split + licensing claims only. |
| """ |
| import matplotlib |
| matplotlib.use("Agg") |
| import matplotlib.pyplot as plt |
| from matplotlib.patches import FancyBboxPatch |
| from matplotlib import font_manager as fm |
|
|
| FT = "Avenir Next" if "Avenir Next" in {f.name for f in fm.fontManager.ttflist} else "Helvetica Neue" |
| plt.rcParams["font.family"] = FT |
|
|
| |
| BG = "#0B0F14" |
| INK = "#EAF1F8" |
| MUTED = "#7E8B9A" |
| FAINT = "#1B232D" |
| GREEN = "#34E0A1" |
| BLUE = "#5AA2FF" |
| VIOLET = "#B98BFF" |
|
|
| |
| domains = [("Legal & official", 4024.9, GREEN), |
| ("Encyclopedic & reference", 1509.1, BLUE), |
| ("Literature & books", 104.0, VIOLET)] |
| total = sum(v for _, v, _ in domains) |
|
|
| fig = plt.figure(figsize=(12, 12), dpi=100) |
| fig.patch.set_facecolor(BG) |
| ax = fig.add_axes([0, 0, 1, 1]); ax.set_xlim(0, 1); ax.set_ylim(0, 1); ax.axis("off") |
| ax.add_patch(plt.Rectangle((0, 0), 1, 1, color=BG, zorder=-10)) |
|
|
| |
| ax.add_patch(plt.Rectangle((0, 0.988), 1, 0.012, color=GREEN, zorder=5)) |
|
|
| |
| ax.text(0.07, 0.915, "P O L I S H L A N G U A G E · O P E N P R E T R A I N I N G D A T A", |
| color=GREEN, fontsize=14.5, weight="bold", alpha=0.95) |
| |
| ax.text(0.07, 0.85, "Licensed to train.", color=INK, fontsize=52, weight="bold") |
| ax.text(0.072, 0.788, |
| "A Polish corpus where every single token is openly licensed —\ncleared for model training, with a documented legal basis.", |
| color=MUTED, fontsize=18.5, linespacing=1.45) |
|
|
| |
| dax = fig.add_axes([0.045, 0.30, 0.44, 0.44]); dax.set_aspect("equal") |
| vals = [v for _, v, _ in domains]; cols = [c for _, _, c in domains] |
| dax.pie(vals, colors=cols, startangle=90, counterclock=False, |
| wedgeprops=dict(width=0.30, edgecolor=BG, linewidth=4)) |
| dax.text(0, 0.10, "5.6B", ha="center", va="center", color=INK, fontsize=58, weight="bold") |
| dax.text(0, -0.12, "openly-licensed tokens", ha="center", va="center", color=MUTED, fontsize=16) |
|
|
| |
| lx, ly = 0.565, 0.625 |
| for name, v, c in domains: |
| ax.add_patch(plt.Circle((lx, ly + 0.011), 0.013, color=c, transform=ax.transAxes)) |
| ax.text(lx + 0.035, ly + 0.020, name, color=INK, fontsize=20, weight="bold", va="center") |
| ax.text(lx + 0.035, ly - 0.012, f"{v/total*100:.0f}% · {v/1000:.1f}B tokens", |
| color=MUTED, fontsize=14.5, va="center") |
| ly -= 0.085 |
|
|
| |
| ax.add_patch(plt.Rectangle((0.07, 0.247), 0.86, 0.0016, color=FAINT)) |
| stats = [("2.4M", "documents"), ("100%", "open licenses"), |
| ("0", "copyrighted media"), ("human", "written, not synthetic")] |
| sx = 0.07 |
| for big, small in stats: |
| ax.text(sx, 0.205, big, color=INK, fontsize=27, weight="bold") |
| ax.text(sx, 0.168, small, color=MUTED, fontsize=14.5) |
| sx += 0.225 |
|
|
| |
| pills = [("Open licenses only", GREEN), ("Traceable provenance", BLUE), |
| ("Deduplicated", VIOLET)] |
| def pw(text): return 0.0125 * len(text) + 0.062 |
| widths = [pw(t) for t, _ in pills] |
| gap, ph, py = 0.022, 0.05, 0.088 |
| total_w = sum(widths) + gap * (len(pills) - 1) |
| px = (1 - total_w) / 2 |
| for (t, c), w in zip(pills, widths): |
| ax.add_patch(FancyBboxPatch((px, py), w, ph, boxstyle="round,pad=0.004,rounding_size=0.024", |
| mutation_aspect=1, fc=FAINT, ec=c, lw=1.7, zorder=3)) |
| cx = px + 0.026 |
| ax.plot([cx, cx + 0.008, cx + 0.02], [py + ph/2, py + ph/2 - 0.008, py + ph/2 + 0.012], |
| color=c, lw=2.8, solid_capstyle="round", solid_joinstyle="round", zorder=5) |
| ax.text(px + w/2 + 0.016, py + ph/2, t, ha="center", va="center", |
| color=INK, fontsize=13.5, weight="bold", zorder=4) |
| px += w + gap |
|
|
| |
| ax.text(0.07, 0.04, "CC-BY-SA · public domain · permissive-only", color=MUTED, fontsize=14) |
| ax.text(0.93, 0.04, "SLAYER LABS", color=INK, fontsize=15, weight="bold", ha="right", alpha=0.9) |
|
|
| import os |
| out = os.path.expanduser("~/Desktop/polish_open_corpus_card.png") |
| fig.savefig(out, facecolor=BG, dpi=100) |
| print("saved", out) |
|
|