- Python 96.4%
- Dockerfile 1.6%
- Makefile 1.1%
- Shell 0.9%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .github/workflows | ||
| _imgs | ||
| _streamlit_app | ||
| scripts | ||
| tests | ||
| .dockerignore | ||
| .gitignore | ||
| .pre-commit-config.yaml | ||
| _.code-workspace | ||
| AGENTS.md | ||
| config.yaml | ||
| Dockerfile | ||
| LICENSE | ||
| Makefile | ||
| NOTES.md | ||
| PLAN.md | ||
| publiccode.yml | ||
| pyproject.toml | ||
| README.md | ||
| uv.lock | ||
Simply simplify language
Rewrite German administrative texts in Einfache Sprache or Leichte Sprache, get sentence-by-sentence writing feedback, and compare drafts from multiple models. The Canton of Zurich developed this Streamlit prototype.
Contents
Important
The app sends submitted text to OpenRouter and the routed model provider. Use only public, non-sensitive data. Review drafts for errors and omissions, ideally with the target audience, especially for Leichte Sprache.
Usage
Running Locally
From the repository root, use uv, Make and Python 3.12 or 3.13. CI tests both versions. The package requires Python 3.12 or newer.
make sync
cp -n _streamlit_app/.env_example _streamlit_app/.env
Set OPENROUTER_API_KEY in _streamlit_app/.env or the process environment.
Create a key and add credits in your OpenRouter account. API keys · Credits
make run
Open http://localhost:8501.
Running with Docker
Set the key in _streamlit_app/.env, then run the following.
make docker-build
make docker-run
Open http://localhost:8080. The run target passes .env to the container at
startup. .dockerignore excludes it from image builds.
Remote deployment
Use the local or Docker setup on your remote host and provide HTTPS and access controls. In a Codespace, follow the local setup and forward port 8501.
Configuring Models
Edit config.yaml to customize available models:
name: UI display nameid: OpenRouter model identifier (e.g.,anthropic/claude-opus-5.5,openai/gpt-6.1-sol)reasoning_effort: Optional reasoning level (default,none,minimal,low,medium,high,xhigh,max). Use levels supported by the model;defaultuses its own defaults.subprovider: Optional list of allowed OpenRouter provider or endpoint slugs, e.g.["openai/flex", "openai"]. A single slug is also accepted;defaultallows all available providers. The app requests price-based routing and restricts fallback to the allowed list. With a provider restriction or explicit reasoning effort, it requests providers that support the supplied parameters. Live provider availability and parameter support are not verified by repository tests.
Restart the app after editing configuration; it is cached for the running process. Model names and IDs should be unique because the app builds dictionaries from them.
For example, add reasoning_effort: "medium" and subprovider: "openai" to a model entry. These settings apply to simplification, analysis, and One-Click requests. See provider selection and reasoning levels.
See the model catalogue at OpenRouter models.
Other settings in config.yaml include a 10,000-character UI input limit, a 120-second API timeout, two SDK retries, and an 8,192-token response limit. api.temperature: "default" omits the temperature parameter; a YAML float supplies an override. These values apply to every model request. The UI defaults to Einfache Sprache; enabling Leichte Sprache also exposes the condensation option, enabled by default.
Data handling
Input and the latest result live in Streamlit session state. The app generates
Word downloads in memory. Optional event logging records text lengths, the
selected model, runtime, mode and success status. Set logging.enabled: true to
write JSON lines to _streamlit_app/app.log or set logging.filename to choose
a path. In One-Click mode, the event records the model selected in the UI.
Model-call failures log exception traces even when event logging is off. Provider error details can include submitted text. See the open logging fix.
Project information
What does the app do?
- Vereinfachen rewrites text using the selected language level and model.
- Analysieren gives sentence-by-sentence feedback on the source.
- One-Klick requests a rewrite from every configured model in parallel. It shows successful drafts and their scores where available, lists partial failures, and displays an error if every model fails.
Download the source and results as a Word document. The prompts use Swiss
Standard German, and the app replaces ß with ss in displayed results.
What does it cost?
Model calls use your OpenRouter account. Costs depend on models, input/output tokens, reasoning, and retries; One-Click calls every configured model. The repository contains no current pricing data or cost benchmark. Check OpenRouter pricing before use and account separately for hosting costs.
Our language guidelines
You can find the current rules that are being prompted in _streamlit_app/utils_prompts.py. Have a look and change these according to your needs and organizational communication guidelines.
We derived the current rules in the prompts mainly from these of our language guidelines:
- General language guidelines zh.ch
- Language guidelines Leichte Sprache
- Guidelines Strassenverkehrsamt
How does the understandability score work?
The zix package
calculates understandability and estimates the CEFR language level. Its Git revision
is pinned in uv.lock. The app loads it in the background after rendering the UI.
ZIX uses sentence length, RIX (a readability index), common-word scores and A1/A2/B1 vocabulary overlap. It scores texts from -10 to +10. Use the score and CEFR estimate as review aids. Check factual accuracy and language rules separately.
What does the score mean?
The current UI classifies the unrounded score using config.yaml:
- Below -2: hard to understand (
schwer verständlich). - From -2 to below 0: moderately understandable (
nur mässig verständlich). - From 0: understandable (
gut verständlich).
These score thresholds are configurable. The displayed numeric score is rounded; CEFR estimates use the unrounded score in every mode. A single simplification shows the output score and change from the source; analysis shows the source score. One-Click shows individual output scores inline and the source score in the metric panel, rather than scoring the combined results.
The app rejects source text that ZIX cannot score before sending a model request. If a generated draft cannot be scored, it remains visible and downloadable with its score marked unavailable.
Project Team
Project contributors from the cantonal administration of Zurich (affiliations recorded by the project):
- Simone Luchetta, Roger Zedi - Team Informationszugang & Dialog, Staatskanzlei
- Emek Sahin, Peter Hotz - Team Kommunikation & Entwicklung, Strassenverkehrsamt
- Roger Meier - Generalsekretariat, Direktion der Justiz und des Inneren
- Matthias Mazenauer - Co-Leiter, Amt für Statistik und Daten
- Marisol Keller, Céline Colombo - Koordinationsstelle Teilhabe, Amt für Statistik und Daten
- Patrick Arnecke, Chantal Amrhein, Dominik Frefel - Team Data, Amt für Statistik und Daten
Special thanks to Government Councillor Jacqueline Fehr for initiating and supporting the project.
Feedback and Contributing
We welcome feedback and contributions! Email us or open an issue or pull request.
We use ruff for linting and formatting. Before
submitting a change, run the complete local quality suite:
make check
Run mutation testing with uv run mutmut run and inspect survivors with
uv run mutmut results. See engineering notes
for the isolated test setup.
Install repository hooks with make install (dependency sync plus pre-commit and pre-push hooks). make check checks formatting, lint, and tests without modifying files. make pre-commit runs configured pre-commit hooks and may change files; pre-push also runs tests and container validation. Container validation skips the build locally if Docker is unavailable; CI requires it.
CI runs pre-commit, tests on Python 3.12/3.13, a full Git-history secret scan, and a container build, health check, and vulnerability scan. The health check tests Streamlit's HTTP endpoint without an API key; it does not validate model calls or ZIX scoring.
Run make help for available commands. See NOTES.md for engineering constraints.
Repository structure
_streamlit_app/sprache-vereinfachen.py: Streamlit UI, API calls, concurrent One-Click requests, session results, and in-memory Word exports._streamlit_app/app_core.py: prompt assembly, routing parameters, result formatting, score labels, paths, background ZIX loading, and optional event logging._streamlit_app/utils_prompts.py: shared prompts, language rules, and sample text._streamlit_app/utils_expander.md: German project information displayed in the app.config.yaml: models, API limits, UI settings, document formatting, score thresholds, and logging.tests/test_app_core.py: deterministic core tests; no live-provider or scoring-calibration tests.Dockerfile,scripts/validate-container.sh,.github/workflows/ci.yaml: container and CI setup.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Miscellaneous
- Thanks to LIIP for refactoring the understandability index as an API and webservice.
- Special shoutout to Christian Stocker.
- Thanks to Florian Georg (Microsoft Switzerland) for help integrating with Azure AI.
Disclaimer
This software (the Software) incorporates open-source models from Spacy and uses LLMs from various providers (Model(s)). This software has been developed according to and with the intent to be used under Swiss law. Please be aware that the EU Artificial Intelligence Act (EU AI Act) may, under certain circumstances, be applicable to your use of the Software. You are solely responsible for ensuring that your use of the Software as well as of the underlying Models complies with all applicable local, national and international laws and regulations. By using this Software, you acknowledge and agree (a) that it is your responsibility to assess which laws and regulations, in particular regarding the use of AI technologies, are applicable to your intended use and to comply therewith, and (b) that you will hold us harmless from any action, claims, liability or loss in respect of your use of the Software.

