Skip to content

Commit e889a91

Browse files
Merge branch 'main' into nn
2 parents b717841 + a03f674 commit e889a91

247 files changed

Lines changed: 24992 additions & 13389 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/PythonScripts/ @moritz-gross

.github/workflows/python.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Python
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
name: Python Tests
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
- uses: astral-sh/setup-uv@v6
12+
- name: Run ruff lint
13+
working-directory: PythonScripts
14+
run: uv run ruff check audit_translations/
15+
- name: Run ruff format check
16+
working-directory: PythonScripts
17+
run: uv run ruff format --check audit_translations/
18+
- name: Run tests
19+
working-directory: PythonScripts
20+
run: uv run pytest

.github/workflows/rust.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
name: Rust
22

3-
on:
4-
push:
5-
branches: [ "main" ]
6-
pull_request:
7-
branches: [ "main" ]
3+
on: [push, pull_request] # note: pre-release job still only on 'refs/heads/main'
84

95
env:
106
CARGO_TERM_COLOR: always
@@ -56,6 +52,7 @@ jobs:
5652
pre-release:
5753
name: Pre Release
5854
continue-on-error: false
55+
if: github.event_name == 'push' && github.ref == 'refs/heads/main' # otherwise, job fails on pull requests, as GITHUB_TOKEN is not available
5956
needs: [zip-rules]
6057
runs-on: ubuntu-latest
6158
permissions:

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,8 @@ src/speech-bak
5252

5353
Rules/*/*/*.zip
5454
.vs
55+
56+
# local caches when building Jekyll
57+
docs/_site
58+
docs/.jekyll-cache
59+
docs/Gemfile.lock

AGENTS.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Agent Notes (MathCAT)
2+
3+
Purpose: fast orientation for coding agents. try to keep low overlap with README.md etc.,
4+
but add common mistakes of AI agents here instead.
5+
6+
## Project Scope
7+
- MathCAT converts MathML to speech, braille, and navigation output.
8+
- Core flow: `set_mathml()` -> `canonicalize.rs` -> optional `infer_intent.rs` -> `speech.rs` / `braille.rs`.
9+
10+
## Rules System (`Rules/`)
11+
- YAML rules are loaded at runtime by domain:
12+
- Common per-language files:
13+
- `ClearSpeak_Rules.yaml`, `SimpleSpeak_Rules.yaml`
14+
- `SharedRules/`, `unicode.yaml`, `unicode-full.yaml`, `definitions.yaml`, `navigate.yaml`
15+
- `build.rs` can bundle rules into `rules.zip` when `include-zip` is enabled.
16+
17+
## Translation Conventions
18+
- `t:` means untranslated or unverified.
19+
- `T:` means translated and verified.
20+
- tool for comparing rules across languages: `uv run --project PythonScripts audit-translations <language-code>`
21+
22+
## Python Tooling (`uv`)
23+
- `uv` is the Python dependency and project manager for repo tooling. Use `uv run <command-name>`
24+
- discuss new packages before adding them. use `uv add <package-name>` and `uv sync` on confirmation
25+
- In sandboxed runs, if needed:
26+
- set `UV_CACHE_DIR=/tmp/uv-cache`
27+
- rerun with escalated permissions if macOS `system-configuration` panics occur.
28+
- *always* self-validate: `ùv run pytest`
29+
30+
## Agent Instructions
31+
- Do not mirror README content here; keep guidance agent-specific.
32+
- Avoid broad formatting sweeps; do not run `cargo fmt` in this repo.
33+
- Keep code/rule changes focused and validate with targeted tests first: `cargo test <relevant-tests>`
34+
- do not do any git commands unless explicitly asked for
35+
- Rust coverage is in `target/coverage/`.

Cargo.toml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ exclude = ["src/main.rs", "docs", "PythonScripts"] # should have "Rules/", bu
1414
[features]
1515
"include-zip" = []
1616
"enable-logs" = ["android_logger"]
17+
"tts" = [ "natural-tts" ]
18+
1719

1820
[dependencies]
1921
sxd-document = "0.3"
@@ -34,15 +36,15 @@ log = "0.4"
3436
env_logger = "0.11.8"
3537
cfg-if = "1.0.1"
3638
fastrand = { version = "2.3.0" }
39+
clap = { version = "*", features = ["derive"] }
3740

3841
[target.'cfg(target_family = "wasm")'.dependencies]
3942
zip = { version = "7.0", default-features = false, features = ["deflate"] }
4043
[target.'cfg(not(target_family = "wasm"))'.dependencies]
4144
zip = { version = "7.0", default-features = false, features = ["bzip2"] }
4245

4346
android_logger = {version = "0.15.1", optional = true}
44-
45-
47+
natural-tts = { version = "*", optional = true }
4648

4749
[build-dependencies]
4850
bitflags = "2.6"
@@ -55,6 +57,11 @@ zip = { version = "7.0", default-features = false, features = ["bzip2"] }
5557
name = "libmathcat"
5658
crate-type = ["rlib", "cdylib"]
5759

60+
[[bin]]
61+
name = "mathml2text"
62+
path = "src/bin/mathml2text.rs"
63+
64+
5865
[profile.test]
5966
debug = true
6067
opt-level = 1 # adds a few seconds to the compile, but cuts testing time by ~75% (~90 secs on 5/24)

PythonScripts/README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,10 @@
22

33
Project management is done with [uv](https://docs.astral.sh/uv/).
44

5-
For example, execute `uv run python -m audit_translations de` to see the translation progress for the German language.
5+
For example, execute `uv run audit-translations de` to see the translation progress for the German language.
6+
7+
If you run from the repo root instead of inside `PythonScripts`, point uv at the project and make sure you've synced once:
8+
```bash
9+
uv sync --project PythonScripts
10+
uv run --project PythonScripts audit-translations de
11+
```

PythonScripts/audit_translations/README.md

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,45 +56,54 @@ The tool automatically adjusts its matching logic based on the file type:
5656

5757
**Syntax:**
5858
```bash
59-
uv run python -m audit_translations <language> [--file <specific_file>]
60-
uv run python -m audit_translations --list
59+
uv run audit-translations <language> [--file <specific_file>]
60+
uv run audit-translations --list
61+
62+
# If running from the repo root, point uv at the project:
63+
uv run --project PythonScripts audit-translations <language>
64+
uv run --project PythonScripts audit-translations --list
6165
```
6266

6367
**Convenience Features:**
6468
* `--list`: Displays all available languages.
6569
* Region variants are shown as `lang-region` (e.g., `zz-aa`) based on subdirectories under `Rules/Languages/<lang>`.
6670
* `--file`: Audits a single specific file instead of the whole directory.
67-
* `--format`: Output format (`rich`, `jsonl`). `--output` is honored only for `jsonl`; rich output always prints to the console.
6871
* `--rules-dir`: Override the Rules/Languages directory path.
6972
* `--only`: Filter issue types (comma-separated): `missing`, `untranslated`, `extra`, `diffs`, `all`.
70-
* `--verbose`: Show detailed output including English/translated snippets for rule differences (only affects rich format; default shows summary only).
73+
* `--verbose`: Show detailed output including English/translated snippets for rule differences.
7174
* **Summary Stats:** Provides a statistical summary after every run.
7275

7376
**Examples:**
7477

7578
```bash
7679
# List available languages
77-
uv run python -m audit_translations --list
80+
uv run audit-translations --list
81+
82+
# Same from repo root
83+
uv run --project PythonScripts audit-translations --list
7884
7985
# Audit all Spanish translation files
80-
uv run python -m audit_translations es
86+
uv run audit-translations es
8187
8288
# Audit German translations
83-
uv run python -m audit_translations de
89+
uv run audit-translations de
8490
8591
# Audit only a specific file
86-
uv run python -m audit_translations es --file SharedRules/default.yaml
87-
88-
# Produce JSONL output for automation or AI workflows
89-
uv run python -m audit_translations es --format jsonl --output es-issues.jsonl
92+
uv run audit-translations es --file SharedRules/default.yaml
9093
9194
# Audit a regional variant (merges Rules/Languages/de and Rules/Languages/de/CH)
92-
uv run python -m audit_translations de-CH
95+
uv run audit-translations de-CH
9396
9497
# Show detailed output with English/translated snippets for rule differences
95-
uv run python -m audit_translations es --verbose
98+
uv run audit-translations es --verbose
99+
```
100+
101+
**Running from the repo root (without `cd PythonScripts`):**
102+
```bash
103+
uv run --project PythonScripts audit-translations es
104+
uv run --project PythonScripts audit-translations --list
96105
```
97106

98107
### Testing
99108

100-
```uv run python -m pytest```
109+
```uv run pytest```

PythonScripts/audit_translations/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@
77
88
Read README.md for more details.
99
"""
10-
import sys
11-
sys.stdout.reconfigure(encoding='utf-8')
10+
1211
from .cli import main
1312

1413
__all__ = [
15-
'main',
14+
"main",
1615
]

0 commit comments

Comments
 (0)