--- title: mundart-explorer — Swiss-German LID emoji: 🗣️ colorFrom: red colorTo: gray sdk: gradio app_file: app.py pinned: false license: cc-by-sa-4.0 datasets: - mischeiwiller/swiss-german-text - mischeiwiller/gsw-eval --- # 🇨🇭 mundart-explorer — Swiss-German language ID + gsw→de alignment Paste a sentence. The Space returns: - **Language identification** — written **Swiss-German (`gsw`)** vs **Standard German (`de`)**, with a confidence. Off-the-shelf language detectors collapse Swiss-German into German; this answers the gsw-vs-de question directly. - **Nearest gsw→de alignment** — the closest Standard-German rendering from the [`gsw-eval`](https://huggingface.co/datasets/mischeiwiller/gsw-eval) probe set (334 genuine Tatoeba `gsw→deu` pairs), shown only when a real aligned pair is close enough — never a fabricated translation. It is part of the **Mundart** project: the open [`mischeiwiller/swiss-german-text`](https://huggingface.co/datasets/mischeiwiller/swiss-german-text) corpus + the [`mischeiwiller/gsw-eval`](https://huggingface.co/datasets/mischeiwiller/gsw-eval) benchmark + this demo. ## How it works - **LID:** a deterministic character n-gram **multinomial Naive Bayes** baseline (`vendor/mundart/baseline.py`, orders 2–4, Laplace `alpha=1.0`), trained at startup on the committed `gsw-eval` LID train split (`data/lid_train.jsonl`). Character n-grams capture the orthographic signal that separates written Swiss-German from Standard German (`ch`/`cht`/`üü`/`scht`, `-li` diminutives, dropped final `-n`). The confidence is a softmax over the two per-class log posteriors. - **Alignment:** char n-gram Jaccard similarity between the input and the 334 probe `gsw` sentences; the nearest pair's Standard-German side is shown when similarity clears a small floor. The baseline is **deterministic by construction** (closed-form counts, no RNG/seed) and pure Python stdlib — so the Space needs no third-party dependencies. The bundled assets (the vendored LID modules + the eval data the app trains on) are copies of the canonical project sources; refresh them with `python build_assets.py`. ## Limitations - The LID baseline is a deliberately **beatable reference** (macro-F1 **0.63** on the held-out test split) — a floor for the benchmark, not a production detector. Short inputs skew toward `gsw` (the training `de` negatives are short single Tatoeba sentences). - Alignment is **lookup, not translation**: it surfaces the nearest pre-aligned pair from a 334-sentence probe set, so most free-form inputs will have no close match. It never machine-translates. - Swiss-German has no standardized orthography; spelling varies widely by writer and region. ## Companion artifacts Part of the **Mundart** project (dataset + eval + demo): - **Dataset:** [`mischeiwiller/swiss-german-text`](https://huggingface.co/datasets/mischeiwiller/swiss-german-text) — the open written-`gsw` corpus. - **Eval:** [`mischeiwiller/gsw-eval`](https://huggingface.co/datasets/mischeiwiller/gsw-eval) — the gsw-vs-de LID benchmark this demo's baseline is trained + scored on. - **Neighbour reference:** [`ZurichNLP/swissbert`](https://huggingface.co/ZurichNLP/swissbert) — a Swiss-German-aware multilingual encoder; a natural upgrade path for the LID head. ## License Code Apache-2.0; bundled eval data CC-BY-SA-4.0 (inherited from the source corpus — per-slice: Alemannic-Wikipedia CC-BY-SA-4.0, Tatoeba CC-BY-2.0-FR, Leipzig CC-BY-4.0). See the dataset cards for full provenance.