Fix Roman numeral handling #528 - #540
Closed
moritz-gross wants to merge 1 commit into
Closed
moritz-gross wants to merge 1 commit into
moritz-gross wants to merge 1 commit into
Conversation
… add regression tests. (daisy#528)
NSoiffer
added a commit
that referenced
this pull request
Jun 1, 2026
Fixes #528. Includes the tests in the PR.
Collaborator
|
The real problem was a bad Rule that missed testing for chemistry. The roman numerals shouldn't be spoken, but some braille codes handle them in a special way (typically modifying the capitalization rules). I've included the tests you wrong in a separate commit. |
NSoiffer
added a commit
that referenced
this pull request
Jun 25, 2026
…589) * Refine matrix rule handling by adding support for augmented matrices; update unit tests to include 2x3 and 3x4 augmented matrix scenarios. (#555) * remove logging statement * removed uneeded eprintlin!() * Alternative fix to PR #540. Fixes #528. Includes the tests in the PR. * Add Russian translation * Fix #585 -- SSML was being escaped. I earlier added code to prevent a SSML injection attack by escaping HTML. It was done at the wrong point and escape legal SSML. I have moved the check and conversion down to the leaves. I was very surprised there were no useful tests with SSML. All the main tests set `TTS=None`. I added a test that catches bad escaping. I also added some tests to check for leaf-based SSML attacks and also attribute-based ones. * bump beta number * The range for MATHEMATICAL SANS-SERIF DIGITs had MATHEMATICAL MONOSPACE DIGITs as the match part of translate, so if one of the sans-serif digits were used, you ended up in a loop (no match, to it returned itself). * comment out some debug statements * Add 02DA (˚) to list of circle-like chars -- I thought I had done this already, so it might in some other branch * Add source language option to translation audit tool Allow audit-translations to compare a target language against any source language via --source, defaulting to English for existing workflows. Update CLI output, docs, and tests for dynamic source/target labels, including Swedish/Norwegian comparison coverage. Normalize Rich ANSI output in tests so golden and string assertions remain stable when terminal color is forced. * fix ruff * fix ruff * fix ruff * Core concept names additions and tests -- issue 381 (#592) * initial addition of core concept names * defnitions and tests, with a few failing * minus, plus, volume fixes. Other defined, not appearing in site * fix clippy warnings * use "ruamel.yaml>=0.19.1" in uv.lock and pyproject.toml * handle canonicalize failure in containerized environments (#574) * add 1 week dependency cooldown for uv (#599) * fix rules for digits in german (#596) * update navigation rules for traditional chinese (#588) * copy english version of navigate.yaml from NVDA2026.1 and translate * 更新 definitions.yaml 與 navigate.yaml * update unicode-full.yaml * 區分完全/已完全放大/縮小 * 移至->移到, 表->表格, 數學式->數學, 退出->離開, 不能->無法, 當前->目前。 overview line 47, SimpleSpeak_Rules.yaml line 39, "根號"->""。mroot.rs 對應修改 * 移到上一格 -> 往上一格,移到下一格 -> 往下一格, 佔位符 -> 書籤,設定佔位符 -> 設定書籤,已是最上層 -> 不在別的式子裡面,上一層是 -> 在後面式子裡面,字元模式 開n 次方根 的讀法,基底 -> 基、底 * 向量 -> 射線 * 基 -> 基底,底 -> 基底 * Internally in definitions.yaml, MathCAT uses "nofix", but that's not a MathML airity property. Remove it. * don't say "indexed by", say "sub" * add some terse and verbose forms of speech * fix typo * Added an html file with all the test exprs so that translators have examples to test. * Fix remaining erros after `definitions.yaml` was updated -- needed to add `function:` * fix clippy warning * minor cleanup: remove ASCIIMath-fi reference * Refactor braille.rs to a BrailleCode trait + registry Replace the four scattered string-match dispatch sites (cleanup, get_braille_chars, NeedsToBeGrouped, and highlight knobs) with a single get_braille_code() registry and a BrailleCode trait implemented per code. Extract the duplicated UEB/Vietnam/Finnish/Swedish indicator-replacement closures into one apply_indicator_replacements helper plus a UserTypeforms struct. Behavior is unchanged (all tests/braille pass); adding a new code now means one registry entry + one impl block. Co-authored-by: Cursor <cursoragent@cursor.com> * improved counting for (likey) 8 bit codes when figuring out braille position * make sure this is part of repo * add BrailleDocs to repo (stop ignoring) * updated data, does not include ASCII letters/digits * First version of Russian Braille This commit adds first druft version for Russian Braille. * typo in example * Russian Braille fixes This commit adds fixes to Russian Braille. Now the test with parentheses is passed. Also there are devision and multiplication signs have been modified according to the Russian braille specs. * Braille - Latin and Greek letters fixes This commit adds a layer of Latin and Greek alphabets for Russian mathematical Braille. * In unicode.yaml Latin and Greek letters now go through the internal markers of the alphabetic mode. • In braille.rs russian_cleanup turns these markers into real signs: ◦ Latin lowercase: ⠠ ◦ Latin uppercase: ⠨ ◦ Greek lowercase: ⠰ ◦ Greek uppercase: ⠸ Added tests to russian.rs to x+A+y+B, the Latin letter after the number. * Braille - Roots, powers and scripts This commit adds Roots, powers and scripts according to the Russian math Braille specs. * Update Russian Braille rules and mappings Fix YAML replace syntax and extend Russian braille rules: add chemical-formula-operator-bond and prefix-geometry-ops rules, broaden function-name matching (include tg/ctg variants) and add separator markers. Update unicode mappings (degree sign, invisible characters, conditional ∪ mapping, parallel/arrow glyphs) and adjust several function/operator braille outputs. Add/expand tests to cover functions, geometry, matrices and chemical formulas to validate the changes. * Add Russian language to docs Add Russian (ru) to the list of supported speech languages and update Russian documentation and translation guidance. - docs/User_guide_for_MathCAT_en.md, docs/index.md: add Russian (ru) to supported languages lists. - docs/ru/User_guide_for_MathCAT_ru.md: include Russian in language options, reorder entries and apply minor wording fixes. - docs/ru/helpers.md: clarify wording, update examples and test instructions to reference ru instead of fr, and improve translation guidance and examples (including test and cargo commands). - docs/ru/index.md: reorder supported languages and polish phrasing. These edits enable and document Russian support and improve clarity for translators and developers working on the Russian localization. * Refactor Russian function braille mapping Replace hardcoded function-name branches in Russian_Rules.yaml with a DefinitionValue lookup that pulls from a new RussianFunctionBraille mapping. Add RussianFunctionBraille entries to definitions.yaml (private-use codepoints U+E100–U+E10E) and map those codepoints to braille strings in unicode.yaml. Add a test covering tan/cot rendering. This centralizes function braille representations and simplifies the rule logic. * Refine Russian wording in translators guide Clarify and naturalize Russian phrasing in the translators guide: add explicit "на русском языке" to SimpleSpeak examples; change exponent wording to "в квадрате" with example "икс в квадрате"; make fraction wording more natural ("числитель разделить на знаменатель" and example "метр за секунду"); fix "английском" → "английском языке"; and update Braille tooling phrasing to "просмотрщиком Брайля" and "дисплее Брайля" for consistency. * Add alphabet indicators in russian_cleanup Insert a preprocessing step that injects braille alphabet indicators before running REPLACE_INDICATORS. A new helper add_russian_alphabet_indicators scans the raw braille and emits specific indicators for 'l' (Latin lowercase), 'u' (Latin uppercase), 'g' (Greek lowercase) and 'v' (Greek uppercase), avoiding repeated indicators by tracking the current alphabet mode. The helper also resets the mode on 'C', 'N', and '#'. This keeps the existing indicator replacement and space-collapsing logic intact while preventing redundant alphabet indicators. * Russian braille: add GOST symbols and decimals Add GOST-style number and symbol support for Russian braille: introduce a decimal-comma rule that emits BrailleChars for integer and fractional parts with a decimal indicator, using PUA digit placeholders. Extend unicode mappings with bracket/brace/slash/backslash/pipe characters, Celsius, context-sensitive prime (′/″) handling, PUA digit-to-braille mappings, and a few arrow/connective symbols. Update tests to cover decimal numbers, fractions, set notation, Celsius, and logical arrows, and adjust expected output for geometry primes to reflect the new context-aware prime handling. * Add vector/bar/arc mover rules and tests Introduce three new mover rules in Rules/Braille/Russian/Russian_Rules.yaml: vector-arrow, vector-bar, and geometry-arc. Each rule detects specific accent characters (arrows: → ⟶ ⇀ ⃗; bars: ¯ ‾ _  ̄; arcs: ⌒ ⏜ ︵) and emits the appropriate braille indicators, using a different form when the base has more than one character. Add corresponding tests in tests/braille/Russian/russian.rs to cover single- and multi-character movers and combined expressions. * Add Russian braille math functions and limits Extend Russian braille rules to support additional math functions and large operator limits. Added new rules for large-op-limits, operator/functions (including special handling for div), and div-specific replacements in Rules/Braille/Russian/*. Updated Russian definitions and unicode mappings to include sinh/cosh/tanh/coth, arg/sgn/det/rank/rg, Re/Im, grad/rot/div, gcd/lcm and related braille codes. Updated global Rules/definitions.yaml to recognize new function names. Fixed braille cleanup in src/braille.rs to normalize div encoding. Added unit tests exercising the new function mappings and large operator limits. * Support system left brace in Russian braille Introduce handling for system left-brace matrices in the Russian braille rules: add InSystemLeftBrace variable, a system-left-brace-opener rule and a system-left-brace-table rule to detect brace-enclosed mtable as a system. Update row-start logic to emit appropriate braille tokens when InSystemLeftBrace is set. Add tests exercising curly-brace matrices, piecewise function (brace with conditions), and vertical-bar matrices to verify the new behavior. * Add Russian chemistry braille rules and tests Extend Russian braille rules to handle chemical notation: add rules for equilibrium-arrow, reaction operators, repeated charges, charges, and charge-with-subscript mappings (chemical-reaction-operator, chemistry-mhchem-equilibrium-arrow, chemistry-repeated-charge, chemistry-charge, chemistry-charge-with-subscript). Update Rules/Braille/Russian/Russian_Rules.yaml to map arrows, +/-, superscripts/subscripts and reaction operators to appropriate braille sequences. Add tests in tests/braille/Russian/russian.rs (source_chemical_reactions_and_charges) covering reaction arrows, charges, subscripts/superscripts and combined examples. --------- Co-authored-by: Moritz Groß <hi@mgross.dev> Co-authored-by: nsoiffer <soiffer@alum.mit.edu> Co-authored-by: Tuomas Pyorre <82783219+ttpyorre@users.noreply.github.com> Co-authored-by: V3nky <venkatesh6114@gmail.com> Co-authored-by: Hon-Jang Yang <hjy1210@users.noreply.github.com> Co-authored-by: nsoiffer <neil.soiffer@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com>
NSoiffer
added a commit
that referenced
this pull request
Jun 25, 2026
* Refine matrix rule handling by adding support for augmented matrices; update unit tests to include 2x3 and 3x4 augmented matrix scenarios. (#555) * remove logging statement * removed uneeded eprintlin!() * Alternative fix to PR #540. Fixes #528. Includes the tests in the PR. * Add Russian translation * Fix #585 -- SSML was being escaped. I earlier added code to prevent a SSML injection attack by escaping HTML. It was done at the wrong point and escape legal SSML. I have moved the check and conversion down to the leaves. I was very surprised there were no useful tests with SSML. All the main tests set `TTS=None`. I added a test that catches bad escaping. I also added some tests to check for leaf-based SSML attacks and also attribute-based ones. * bump beta number * The range for MATHEMATICAL SANS-SERIF DIGITs had MATHEMATICAL MONOSPACE DIGITs as the match part of translate, so if one of the sans-serif digits were used, you ended up in a loop (no match, to it returned itself). * comment out some debug statements * Add 02DA (˚) to list of circle-like chars -- I thought I had done this already, so it might in some other branch * Add source language option to translation audit tool Allow audit-translations to compare a target language against any source language via --source, defaulting to English for existing workflows. Update CLI output, docs, and tests for dynamic source/target labels, including Swedish/Norwegian comparison coverage. Normalize Rich ANSI output in tests so golden and string assertions remain stable when terminal color is forced. * fix ruff * fix ruff * fix ruff * Core concept names additions and tests -- issue 381 (#592) * initial addition of core concept names * defnitions and tests, with a few failing * minus, plus, volume fixes. Other defined, not appearing in site * fix clippy warnings * use "ruamel.yaml>=0.19.1" in uv.lock and pyproject.toml * handle canonicalize failure in containerized environments (#574) * add 1 week dependency cooldown for uv (#599) * fix rules for digits in german (#596) * update navigation rules for traditional chinese (#588) * copy english version of navigate.yaml from NVDA2026.1 and translate * 更新 definitions.yaml 與 navigate.yaml * update unicode-full.yaml * 區分完全/已完全放大/縮小 * 移至->移到, 表->表格, 數學式->數學, 退出->離開, 不能->無法, 當前->目前。 overview line 47, SimpleSpeak_Rules.yaml line 39, "根號"->""。mroot.rs 對應修改 * 移到上一格 -> 往上一格,移到下一格 -> 往下一格, 佔位符 -> 書籤,設定佔位符 -> 設定書籤,已是最上層 -> 不在別的式子裡面,上一層是 -> 在後面式子裡面,字元模式 開n 次方根 的讀法,基底 -> 基、底 * 向量 -> 射線 * 基 -> 基底,底 -> 基底 * Internally in definitions.yaml, MathCAT uses "nofix", but that's not a MathML airity property. Remove it. * don't say "indexed by", say "sub" * add some terse and verbose forms of speech * fix typo * Added an html file with all the test exprs so that translators have examples to test. * Fix remaining erros after `definitions.yaml` was updated -- needed to add `function:` * fix clippy warning * minor cleanup: remove ASCIIMath-fi reference * Refactor braille.rs to a BrailleCode trait + registry Replace the four scattered string-match dispatch sites (cleanup, get_braille_chars, NeedsToBeGrouped, and highlight knobs) with a single get_braille_code() registry and a BrailleCode trait implemented per code. Extract the duplicated UEB/Vietnam/Finnish/Swedish indicator-replacement closures into one apply_indicator_replacements helper plus a UserTypeforms struct. Behavior is unchanged (all tests/braille pass); adding a new code now means one registry entry + one impl block. Co-authored-by: Cursor <cursoragent@cursor.com> * improved counting for (likey) 8 bit codes when figuring out braille position * make sure this is part of repo * add BrailleDocs to repo (stop ignoring) * updated data, does not include ASCII letters/digits * First version of Russian Braille This commit adds first druft version for Russian Braille. * typo in example * Russian Braille fixes This commit adds fixes to Russian Braille. Now the test with parentheses is passed. Also there are devision and multiplication signs have been modified according to the Russian braille specs. * Braille - Latin and Greek letters fixes This commit adds a layer of Latin and Greek alphabets for Russian mathematical Braille. * In unicode.yaml Latin and Greek letters now go through the internal markers of the alphabetic mode. • In braille.rs russian_cleanup turns these markers into real signs: ◦ Latin lowercase: ⠠ ◦ Latin uppercase: ⠨ ◦ Greek lowercase: ⠰ ◦ Greek uppercase: ⠸ Added tests to russian.rs to x+A+y+B, the Latin letter after the number. * Braille - Roots, powers and scripts This commit adds Roots, powers and scripts according to the Russian math Braille specs. * Update Russian Braille rules and mappings Fix YAML replace syntax and extend Russian braille rules: add chemical-formula-operator-bond and prefix-geometry-ops rules, broaden function-name matching (include tg/ctg variants) and add separator markers. Update unicode mappings (degree sign, invisible characters, conditional ∪ mapping, parallel/arrow glyphs) and adjust several function/operator braille outputs. Add/expand tests to cover functions, geometry, matrices and chemical formulas to validate the changes. * Add Russian language to docs Add Russian (ru) to the list of supported speech languages and update Russian documentation and translation guidance. - docs/User_guide_for_MathCAT_en.md, docs/index.md: add Russian (ru) to supported languages lists. - docs/ru/User_guide_for_MathCAT_ru.md: include Russian in language options, reorder entries and apply minor wording fixes. - docs/ru/helpers.md: clarify wording, update examples and test instructions to reference ru instead of fr, and improve translation guidance and examples (including test and cargo commands). - docs/ru/index.md: reorder supported languages and polish phrasing. These edits enable and document Russian support and improve clarity for translators and developers working on the Russian localization. * Refactor Russian function braille mapping Replace hardcoded function-name branches in Russian_Rules.yaml with a DefinitionValue lookup that pulls from a new RussianFunctionBraille mapping. Add RussianFunctionBraille entries to definitions.yaml (private-use codepoints U+E100–U+E10E) and map those codepoints to braille strings in unicode.yaml. Add a test covering tan/cot rendering. This centralizes function braille representations and simplifies the rule logic. * Refine Russian wording in translators guide Clarify and naturalize Russian phrasing in the translators guide: add explicit "на русском языке" to SimpleSpeak examples; change exponent wording to "в квадрате" with example "икс в квадрате"; make fraction wording more natural ("числитель разделить на знаменатель" and example "метр за секунду"); fix "английском" → "английском языке"; and update Braille tooling phrasing to "просмотрщиком Брайля" and "дисплее Брайля" for consistency. * Add alphabet indicators in russian_cleanup Insert a preprocessing step that injects braille alphabet indicators before running REPLACE_INDICATORS. A new helper add_russian_alphabet_indicators scans the raw braille and emits specific indicators for 'l' (Latin lowercase), 'u' (Latin uppercase), 'g' (Greek lowercase) and 'v' (Greek uppercase), avoiding repeated indicators by tracking the current alphabet mode. The helper also resets the mode on 'C', 'N', and '#'. This keeps the existing indicator replacement and space-collapsing logic intact while preventing redundant alphabet indicators. * Russian braille: add GOST symbols and decimals Add GOST-style number and symbol support for Russian braille: introduce a decimal-comma rule that emits BrailleChars for integer and fractional parts with a decimal indicator, using PUA digit placeholders. Extend unicode mappings with bracket/brace/slash/backslash/pipe characters, Celsius, context-sensitive prime (′/″) handling, PUA digit-to-braille mappings, and a few arrow/connective symbols. Update tests to cover decimal numbers, fractions, set notation, Celsius, and logical arrows, and adjust expected output for geometry primes to reflect the new context-aware prime handling. * Add vector/bar/arc mover rules and tests Introduce three new mover rules in Rules/Braille/Russian/Russian_Rules.yaml: vector-arrow, vector-bar, and geometry-arc. Each rule detects specific accent characters (arrows: → ⟶ ⇀ ⃗; bars: ¯ ‾ _  ̄; arcs: ⌒ ⏜ ︵) and emits the appropriate braille indicators, using a different form when the base has more than one character. Add corresponding tests in tests/braille/Russian/russian.rs to cover single- and multi-character movers and combined expressions. * Add Russian braille math functions and limits Extend Russian braille rules to support additional math functions and large operator limits. Added new rules for large-op-limits, operator/functions (including special handling for div), and div-specific replacements in Rules/Braille/Russian/*. Updated Russian definitions and unicode mappings to include sinh/cosh/tanh/coth, arg/sgn/det/rank/rg, Re/Im, grad/rot/div, gcd/lcm and related braille codes. Updated global Rules/definitions.yaml to recognize new function names. Fixed braille cleanup in src/braille.rs to normalize div encoding. Added unit tests exercising the new function mappings and large operator limits. * Support system left brace in Russian braille Introduce handling for system left-brace matrices in the Russian braille rules: add InSystemLeftBrace variable, a system-left-brace-opener rule and a system-left-brace-table rule to detect brace-enclosed mtable as a system. Update row-start logic to emit appropriate braille tokens when InSystemLeftBrace is set. Add tests exercising curly-brace matrices, piecewise function (brace with conditions), and vertical-bar matrices to verify the new behavior. * Add Russian chemistry braille rules and tests Extend Russian braille rules to handle chemical notation: add rules for equilibrium-arrow, reaction operators, repeated charges, charges, and charge-with-subscript mappings (chemical-reaction-operator, chemistry-mhchem-equilibrium-arrow, chemistry-repeated-charge, chemistry-charge, chemistry-charge-with-subscript). Update Rules/Braille/Russian/Russian_Rules.yaml to map arrows, +/-, superscripts/subscripts and reaction operators to appropriate braille sequences. Add tests in tests/braille/Russian/russian.rs (source_chemical_reactions_and_charges) covering reaction arrows, charges, subscripts/superscripts and combined examples. * Add signed-integer and nested-fraction rules Add handling for nested fractions and signed integers inside script positions and adjust grouping behavior for scripts in Russian braille rules. Changes introduce a nested-fraction rule for mfrac and new signed-integer-number / signed-integer rules for msub/munder and msup/mover, plus a small grouping test (⠐) when scripts contain grouped mrow with '+' or a fraction. Also add a comprehensive regression test (script_grouping_regressions) covering many sup/sub cases to ensure correct braille output. Files updated: Rules/Braille/Russian/Russian_Rules.yaml and tests/braille/Russian/russian.rs. --------- Co-authored-by: Moritz Groß <hi@mgross.dev> Co-authored-by: nsoiffer <soiffer@alum.mit.edu> Co-authored-by: Tuomas Pyorre <82783219+ttpyorre@users.noreply.github.com> Co-authored-by: V3nky <venkatesh6114@gmail.com> Co-authored-by: Hon-Jang Yang <hjy1210@users.noreply.github.com> Co-authored-by: nsoiffer <neil.soiffer@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com>
NSoiffer
added a commit
that referenced
this pull request
Aug 1, 2026
* Refine matrix rule handling by adding support for augmented matrices; update unit tests to include 2x3 and 3x4 augmented matrix scenarios. (#555) * remove logging statement * removed uneeded eprintlin!() * Alternative fix to PR #540. Fixes #528. Includes the tests in the PR. * Add Russian translation * Fix #585 -- SSML was being escaped. I earlier added code to prevent a SSML injection attack by escaping HTML. It was done at the wrong point and escape legal SSML. I have moved the check and conversion down to the leaves. I was very surprised there were no useful tests with SSML. All the main tests set `TTS=None`. I added a test that catches bad escaping. I also added some tests to check for leaf-based SSML attacks and also attribute-based ones. * bump beta number * The range for MATHEMATICAL SANS-SERIF DIGITs had MATHEMATICAL MONOSPACE DIGITs as the match part of translate, so if one of the sans-serif digits were used, you ended up in a loop (no match, to it returned itself). * comment out some debug statements * Add 02DA (˚) to list of circle-like chars -- I thought I had done this already, so it might in some other branch * Add source language option to translation audit tool Allow audit-translations to compare a target language against any source language via --source, defaulting to English for existing workflows. Update CLI output, docs, and tests for dynamic source/target labels, including Swedish/Norwegian comparison coverage. Normalize Rich ANSI output in tests so golden and string assertions remain stable when terminal color is forced. * fix ruff * fix ruff * fix ruff * Core concept names additions and tests -- issue 381 (#592) * initial addition of core concept names * defnitions and tests, with a few failing * minus, plus, volume fixes. Other defined, not appearing in site * fix clippy warnings * use "ruamel.yaml>=0.19.1" in uv.lock and pyproject.toml * handle canonicalize failure in containerized environments (#574) * add 1 week dependency cooldown for uv (#599) * fix rules for digits in german (#596) * update navigation rules for traditional chinese (#588) * copy english version of navigate.yaml from NVDA2026.1 and translate * 更新 definitions.yaml 與 navigate.yaml * update unicode-full.yaml * 區分完全/已完全放大/縮小 * 移至->移到, 表->表格, 數學式->數學, 退出->離開, 不能->無法, 當前->目前。 overview line 47, SimpleSpeak_Rules.yaml line 39, "根號"->""。mroot.rs 對應修改 * 移到上一格 -> 往上一格,移到下一格 -> 往下一格, 佔位符 -> 書籤,設定佔位符 -> 設定書籤,已是最上層 -> 不在別的式子裡面,上一層是 -> 在後面式子裡面,字元模式 開n 次方根 的讀法,基底 -> 基、底 * 向量 -> 射線 * 基 -> 基底,底 -> 基底 * Internally in definitions.yaml, MathCAT uses "nofix", but that's not a MathML airity property. Remove it. * don't say "indexed by", say "sub" * add some terse and verbose forms of speech * fix typo * Added an html file with all the test exprs so that translators have examples to test. * Fix remaining erros after `definitions.yaml` was updated -- needed to add `function:` * fix clippy warning * minor cleanup: remove ASCIIMath-fi reference * Refactor braille.rs to a BrailleCode trait + registry Replace the four scattered string-match dispatch sites (cleanup, get_braille_chars, NeedsToBeGrouped, and highlight knobs) with a single get_braille_code() registry and a BrailleCode trait implemented per code. Extract the duplicated UEB/Vietnam/Finnish/Swedish indicator-replacement closures into one apply_indicator_replacements helper plus a UserTypeforms struct. Behavior is unchanged (all tests/braille pass); adding a new code now means one registry entry + one impl block. Co-authored-by: Cursor <cursoragent@cursor.com> * improved counting for (likey) 8 bit codes when figuring out braille position * make sure this is part of repo * add BrailleDocs to repo (stop ignoring) * updated data, does not include ASCII letters/digits * First version of Russian Braille This commit adds first druft version for Russian Braille. * typo in example * Russian Braille fixes This commit adds fixes to Russian Braille. Now the test with parentheses is passed. Also there are devision and multiplication signs have been modified according to the Russian braille specs. * Braille - Latin and Greek letters fixes This commit adds a layer of Latin and Greek alphabets for Russian mathematical Braille. * In unicode.yaml Latin and Greek letters now go through the internal markers of the alphabetic mode. • In braille.rs russian_cleanup turns these markers into real signs: ◦ Latin lowercase: ⠠ ◦ Latin uppercase: ⠨ ◦ Greek lowercase: ⠰ ◦ Greek uppercase: ⠸ Added tests to russian.rs to x+A+y+B, the Latin letter after the number. * Braille - Roots, powers and scripts This commit adds Roots, powers and scripts according to the Russian math Braille specs. * Update Russian Braille rules and mappings Fix YAML replace syntax and extend Russian braille rules: add chemical-formula-operator-bond and prefix-geometry-ops rules, broaden function-name matching (include tg/ctg variants) and add separator markers. Update unicode mappings (degree sign, invisible characters, conditional ∪ mapping, parallel/arrow glyphs) and adjust several function/operator braille outputs. Add/expand tests to cover functions, geometry, matrices and chemical formulas to validate the changes. * Add Russian language to docs Add Russian (ru) to the list of supported speech languages and update Russian documentation and translation guidance. - docs/User_guide_for_MathCAT_en.md, docs/index.md: add Russian (ru) to supported languages lists. - docs/ru/User_guide_for_MathCAT_ru.md: include Russian in language options, reorder entries and apply minor wording fixes. - docs/ru/helpers.md: clarify wording, update examples and test instructions to reference ru instead of fr, and improve translation guidance and examples (including test and cargo commands). - docs/ru/index.md: reorder supported languages and polish phrasing. These edits enable and document Russian support and improve clarity for translators and developers working on the Russian localization. * Refactor Russian function braille mapping Replace hardcoded function-name branches in Russian_Rules.yaml with a DefinitionValue lookup that pulls from a new RussianFunctionBraille mapping. Add RussianFunctionBraille entries to definitions.yaml (private-use codepoints U+E100–U+E10E) and map those codepoints to braille strings in unicode.yaml. Add a test covering tan/cot rendering. This centralizes function braille representations and simplifies the rule logic. * Refine Russian wording in translators guide Clarify and naturalize Russian phrasing in the translators guide: add explicit "на русском языке" to SimpleSpeak examples; change exponent wording to "в квадрате" with example "икс в квадрате"; make fraction wording more natural ("числитель разделить на знаменатель" and example "метр за секунду"); fix "английском" → "английском языке"; and update Braille tooling phrasing to "просмотрщиком Брайля" and "дисплее Брайля" for consistency. * Add alphabet indicators in russian_cleanup Insert a preprocessing step that injects braille alphabet indicators before running REPLACE_INDICATORS. A new helper add_russian_alphabet_indicators scans the raw braille and emits specific indicators for 'l' (Latin lowercase), 'u' (Latin uppercase), 'g' (Greek lowercase) and 'v' (Greek uppercase), avoiding repeated indicators by tracking the current alphabet mode. The helper also resets the mode on 'C', 'N', and '#'. This keeps the existing indicator replacement and space-collapsing logic intact while preventing redundant alphabet indicators. * Russian braille: add GOST symbols and decimals Add GOST-style number and symbol support for Russian braille: introduce a decimal-comma rule that emits BrailleChars for integer and fractional parts with a decimal indicator, using PUA digit placeholders. Extend unicode mappings with bracket/brace/slash/backslash/pipe characters, Celsius, context-sensitive prime (′/″) handling, PUA digit-to-braille mappings, and a few arrow/connective symbols. Update tests to cover decimal numbers, fractions, set notation, Celsius, and logical arrows, and adjust expected output for geometry primes to reflect the new context-aware prime handling. * Add vector/bar/arc mover rules and tests Introduce three new mover rules in Rules/Braille/Russian/Russian_Rules.yaml: vector-arrow, vector-bar, and geometry-arc. Each rule detects specific accent characters (arrows: → ⟶ ⇀ ⃗; bars: ¯ ‾ _  ̄; arcs: ⌒ ⏜ ︵) and emits the appropriate braille indicators, using a different form when the base has more than one character. Add corresponding tests in tests/braille/Russian/russian.rs to cover single- and multi-character movers and combined expressions. * Add Russian braille math functions and limits Extend Russian braille rules to support additional math functions and large operator limits. Added new rules for large-op-limits, operator/functions (including special handling for div), and div-specific replacements in Rules/Braille/Russian/*. Updated Russian definitions and unicode mappings to include sinh/cosh/tanh/coth, arg/sgn/det/rank/rg, Re/Im, grad/rot/div, gcd/lcm and related braille codes. Updated global Rules/definitions.yaml to recognize new function names. Fixed braille cleanup in src/braille.rs to normalize div encoding. Added unit tests exercising the new function mappings and large operator limits. * Support system left brace in Russian braille Introduce handling for system left-brace matrices in the Russian braille rules: add InSystemLeftBrace variable, a system-left-brace-opener rule and a system-left-brace-table rule to detect brace-enclosed mtable as a system. Update row-start logic to emit appropriate braille tokens when InSystemLeftBrace is set. Add tests exercising curly-brace matrices, piecewise function (brace with conditions), and vertical-bar matrices to verify the new behavior. * Add Russian chemistry braille rules and tests Extend Russian braille rules to handle chemical notation: add rules for equilibrium-arrow, reaction operators, repeated charges, charges, and charge-with-subscript mappings (chemical-reaction-operator, chemistry-mhchem-equilibrium-arrow, chemistry-repeated-charge, chemistry-charge, chemistry-charge-with-subscript). Update Rules/Braille/Russian/Russian_Rules.yaml to map arrows, +/-, superscripts/subscripts and reaction operators to appropriate braille sequences. Add tests in tests/braille/Russian/russian.rs (source_chemical_reactions_and_charges) covering reaction arrows, charges, subscripts/superscripts and combined examples. * Add signed-integer and nested-fraction rules Add handling for nested fractions and signed integers inside script positions and adjust grouping behavior for scripts in Russian braille rules. Changes introduce a nested-fraction rule for mfrac and new signed-integer-number / signed-integer rules for msub/munder and msup/mover, plus a small grouping test (⠐) when scripts contain grouped mrow with '+' or a fraction. Also add a comprehensive regression test (script_grouping_regressions) covering many sup/sub cases to ensure correct braille output. Files updated: Rules/Braille/Russian/Russian_Rules.yaml and tests/braille/Russian/russian.rs. * Add Russian braille label marks and tests Introduce comprehensive Russian braille label handling: new label/mark rules (exact-over/under, upper/lower-right, repeated/no-indicator, left-labels) and mmultiscripts prescript/postscript logic in Rules/Braille/Russian/Russian_Rules.yaml. Add Unicode braille mappings and new definition maps (RussianLabelMarks, RussianExactOverLabelMarksWithoutIndicator, RussianUpperRightLabelMarksWithoutIndicator) in definitions.yaml and unicode.yaml, and change '%' mapping. Expand tests (tests/braille/Russian/russian.rs) with cases for percent/special marks, labeled table rows, mmultiscripts variants, digit sequences, infinity index, complex sup fractions and many label-mark expectations. * Add Russian braille support for periodic decimals and mixed numbers Add braille rules for rendering periodic (repeating) decimals like 0,4(71) and mixed numbers with simple/arithmetic fractions in Russian. Includes regex cleanup to remove redundant number indicators in periodic decimal portions and comprehensive test coverage. * Add Russian braille rules for geometry operators Add three new braille encoding rules for geometry operators (∠, △, ∪) in Russian: - canonical-prefix-geometry-op: handles geometry operators in canonical form - geometry-prefix-after-canonical-multiplier: handles operators after canonical multipliers - geometry-prefix-after-multiplier: handles operators after regular multipliers Includes corresponding test cases for angles, triangles, unions, perpendicular, and similar symbols. * Adjust Russian braille union handling and add tests Move the special-case braille for the union operator out of the global unicode map and into the Russian rule that handles geometric prefix usage, and tighten the rule match to only trigger when preceded by a number. Update unicode.yaml to a consistent union mapping. Add unit tests covering set relations (∈, ∉, ⊂, ⊄, ∩, ∪), empty set, and quantifiers (∀, ∃) plus geometry/operator cases to validate the new behavior. Files changed: Rules/Braille/Russian/Russian_Rules.yaml, Rules/Braille/Russian/unicode.yaml, tests/braille/Russian/russian.rs * Improve Russian braille typeform and mathvariant handling Refactor Russian braille cleanup to properly handle typeform indicators (bold, italic) and mathvariant attributes. Introduces a dedicated typeform indicator function that manages indicator placement according to Russian Braille ГОСТ Р 58511 standard, separating typeform handling from alphabet indicators. Adds support for automatic typeform indicators based on mathvariant attributes, ensuring proper indicator pairing around content blocks. Updates unicode-full.yaml rules to reflect new typeform codes and adds comprehensive tests for various mathvariant combinations. * Add Russian Braille chemistry notation rules Add support for chemical equations in Russian Braille, including: - Single-letter element group notation with prefix marker ⠸ - Reaction arrow handling for mover, munder, and munderover (above, below, above-and-below) - Improved chemical element rendering with InChemElementGroup context variable Includes comprehensive test cases for various chemical formula patterns and reaction arrow configurations. * Add Russian braille mappings and tests Update Russian braille symbol map and extend tests. Rules/Braille/Russian/unicode.yaml: add mappings for №, §, …, ↵, ⏎ and ⍰. tests/braille/Russian/russian.rs: add source_general_math_text_rules unit (covers №, §, ellipsis, return symbols and mixed expressions) and a roman-numeral Latin-indicator test. Ensures MathCAT produces expected braille outputs for these symbols and cases. * Add column arithmetic and enhance Russian braille rules Adds support for column arithmetic formatting with dedicated rules for operators and continuation numbers. Improves fraction rendering for negative denominators and decimal numbers. Enhances trigonometric function handling with power notation and mixed subscript/superscript support. Adds comprehensive tests covering column arithmetic, thin fractions, indexes, and various mathematical constructs. * Optimize braille string operations for single chars Replace push_str() and insert_str() calls with more efficient push() and insert() methods when operating on single Braille characters. This is more idiomatic Rust and avoids unnecessary string allocation overhead. * Verify RU speech strings; add nav & unit rules Convert many Russian speech entries from t: to T: (marking translations as verified) across SharedRules (calculus, geometry, linear-algebra, overview, etc.). Add new RU rules: power-indexed-by, unit-terse, a currency placeholder, and several navigation parity/placeholder rules (into-or-out-of-*, zoom-in-*, move-next/prev-character, and related none/mprescripts entries). Normalize some tag values (none without quotes). Most new navigation/currency rules use match: false() to preserve existing runtime behavior while providing parity with English rules. * Add Russian braille rules for geometry accents Add braille transcription rules for Russian geometry notation with over/under accents: - geometry-line-double-arrow: handles double-arrow symbols (↔⟷) in mover - lower-vector-arrow: handles vector arrows (→⟶⇀⃗) in munder - lower-geometry-line-double-arrow: handles double-arrow symbols in munder - lower-vector-bar: handles bar accents (¯‾_ ̄) in munder Includes corresponding test cases for measurements, physical quantities, and geometry notation. * Add vector and long-division Russian braille rules Add braille rules for vector notation (arrow, bar, and double-arrow postfix operators) and long-division formatting in Russian. Includes support for system braces and new test cases covering vector notation in geometry, long-division examples, and less common mathematical symbols. * Add postscripts and new label marks for Russian Braille Enhance mmultiscripts rule to handle postscripts (subscripts/superscripts after base element) in addition to prescripts. Add new character mappings for '?' and '←' symbols as label marks in Russian Braille. Includes comprehensive test coverage for the new functionality. * Fix Russian percent braille and add per mille sign Simplify the Russian braille representation for the percent sign (%) by removing the middle dot, and add support for the per mille sign (‰) with its braille representation. Updates corresponding test cases. * Propagate mathvariant attribute to children Add mathvariant inheritance from parent elements to children that lack their own mathvariant attribute. This ensures consistent styling throughout nested elements. Includes tests for bold text propagation through mstyle and mrow containers, and verifies that explicit child mathvariants override inherited values. * Fix clippy warnings and improve code style - Remove unnecessary borrows in format! and display calls - Change string slices to arrays in trim_end_matches calls - Replace expect(&format!(...)) with unwrap_or_else(|_| panic!(...)) - Add clippy allow attributes to suppress false positives in tests - Add missing newline at end of build.rs * Remove redundant references in prefs and shim_filesystem Clean up redundant '&' borrows in formatting and logging calls. Updated src/prefs.rs and src/shim_filesystem.rs to pass values directly (e.g. using self.error, path.display(), pref_to_string(...)) instead of creating unnecessary double-references like &&String. This is a small code-style/linting cleanup with no intended behavior change. * Remove unnecessary borrows in format macros Remove redundant `&` reference operators from arguments passed to format! macros and similar functions. These values are automatically borrowed by the format machinery, so explicit borrows are unnecessary and reduce readability. * Normalize Unicode math digits in decimal numbers Add normalization of Unicode mathematical alphanumeric symbols (Plane 1 digits) to ASCII digits for number nodes containing decimal points. Skip canonicalize_plane1 processing for already-normalized nodes to prevent double processing. * Remove unnecessary references and .to_string() calls Remove unnecessary `&` borrows in format arguments and replace `.to_string()` with direct display. Simplify byte array literals to byte string literals for readability and idiomatic Rust style. * Remove mathvariant propagation and update tests Drop implicit propagation of the mathvariant attribute from canonicalization (removed propagate_inherited_mathvariant call and helper functions) and update Russian braille tests to set mathvariant explicitly on elements (replace mstyle with mrow and move attributes to mi). Changes in src/canonicalize.rs and tests/braille/Russian/russian.rs. This makes mathvariant handling explicit in tests and avoids mutating child nodes during canonicalization. * Remove math digit normalization for mn nodes Delete the conditional normalization of mathematical digit characters for <mn> text and remove the normalize_math_digits helper from src/canonicalize.rs. Previously the code converted several Unicode math-digit codepoints to ASCII when a decimal point was present. --------- Co-authored-by: Moritz Groß <hi@mgross.dev> Co-authored-by: nsoiffer <soiffer@alum.mit.edu> Co-authored-by: Tuomas Pyorre <82783219+ttpyorre@users.noreply.github.com> Co-authored-by: V3nky <venkatesh6114@gmail.com> Co-authored-by: Hon-Jang Yang <hjy1210@users.noreply.github.com> Co-authored-by: nsoiffer <neil.soiffer@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Kostenkov-2021
added a commit
to Kostenkov-2021/MathCAT
that referenced
this pull request
Aug 3, 2026
…aisy#589) * Refine matrix rule handling by adding support for augmented matrices; update unit tests to include 2x3 and 3x4 augmented matrix scenarios. (daisy#555) * remove logging statement * removed uneeded eprintlin!() * Alternative fix to PR daisy#540. Fixes daisy#528. Includes the tests in the PR. * Add Russian translation * Fix daisy#585 -- SSML was being escaped. I earlier added code to prevent a SSML injection attack by escaping HTML. It was done at the wrong point and escape legal SSML. I have moved the check and conversion down to the leaves. I was very surprised there were no useful tests with SSML. All the main tests set `TTS=None`. I added a test that catches bad escaping. I also added some tests to check for leaf-based SSML attacks and also attribute-based ones. * bump beta number * The range for MATHEMATICAL SANS-SERIF DIGITs had MATHEMATICAL MONOSPACE DIGITs as the match part of translate, so if one of the sans-serif digits were used, you ended up in a loop (no match, to it returned itself). * comment out some debug statements * Add 02DA (˚) to list of circle-like chars -- I thought I had done this already, so it might in some other branch * Add source language option to translation audit tool Allow audit-translations to compare a target language against any source language via --source, defaulting to English for existing workflows. Update CLI output, docs, and tests for dynamic source/target labels, including Swedish/Norwegian comparison coverage. Normalize Rich ANSI output in tests so golden and string assertions remain stable when terminal color is forced. * fix ruff * fix ruff * fix ruff * Core concept names additions and tests -- issue 381 (daisy#592) * initial addition of core concept names * defnitions and tests, with a few failing * minus, plus, volume fixes. Other defined, not appearing in site * fix clippy warnings * use "ruamel.yaml>=0.19.1" in uv.lock and pyproject.toml * handle canonicalize failure in containerized environments (daisy#574) * add 1 week dependency cooldown for uv (daisy#599) * fix rules for digits in german (daisy#596) * update navigation rules for traditional chinese (daisy#588) * copy english version of navigate.yaml from NVDA2026.1 and translate * 更新 definitions.yaml 與 navigate.yaml * update unicode-full.yaml * 區分完全/已完全放大/縮小 * 移至->移到, 表->表格, 數學式->數學, 退出->離開, 不能->無法, 當前->目前。 overview line 47, SimpleSpeak_Rules.yaml line 39, "根號"->""。mroot.rs 對應修改 * 移到上一格 -> 往上一格,移到下一格 -> 往下一格, 佔位符 -> 書籤,設定佔位符 -> 設定書籤,已是最上層 -> 不在別的式子裡面,上一層是 -> 在後面式子裡面,字元模式 開n 次方根 的讀法,基底 -> 基、底 * 向量 -> 射線 * 基 -> 基底,底 -> 基底 * Internally in definitions.yaml, MathCAT uses "nofix", but that's not a MathML airity property. Remove it. * don't say "indexed by", say "sub" * add some terse and verbose forms of speech * fix typo * Added an html file with all the test exprs so that translators have examples to test. * Fix remaining erros after `definitions.yaml` was updated -- needed to add `function:` * fix clippy warning * minor cleanup: remove ASCIIMath-fi reference * Refactor braille.rs to a BrailleCode trait + registry Replace the four scattered string-match dispatch sites (cleanup, get_braille_chars, NeedsToBeGrouped, and highlight knobs) with a single get_braille_code() registry and a BrailleCode trait implemented per code. Extract the duplicated UEB/Vietnam/Finnish/Swedish indicator-replacement closures into one apply_indicator_replacements helper plus a UserTypeforms struct. Behavior is unchanged (all tests/braille pass); adding a new code now means one registry entry + one impl block. Co-authored-by: Cursor <cursoragent@cursor.com> * improved counting for (likey) 8 bit codes when figuring out braille position * make sure this is part of repo * add BrailleDocs to repo (stop ignoring) * updated data, does not include ASCII letters/digits * First version of Russian Braille This commit adds first druft version for Russian Braille. * typo in example * Russian Braille fixes This commit adds fixes to Russian Braille. Now the test with parentheses is passed. Also there are devision and multiplication signs have been modified according to the Russian braille specs. * Braille - Latin and Greek letters fixes This commit adds a layer of Latin and Greek alphabets for Russian mathematical Braille. * In unicode.yaml Latin and Greek letters now go through the internal markers of the alphabetic mode. • In braille.rs russian_cleanup turns these markers into real signs: ◦ Latin lowercase: ⠠ ◦ Latin uppercase: ⠨ ◦ Greek lowercase: ⠰ ◦ Greek uppercase: ⠸ Added tests to russian.rs to x+A+y+B, the Latin letter after the number. * Braille - Roots, powers and scripts This commit adds Roots, powers and scripts according to the Russian math Braille specs. * Update Russian Braille rules and mappings Fix YAML replace syntax and extend Russian braille rules: add chemical-formula-operator-bond and prefix-geometry-ops rules, broaden function-name matching (include tg/ctg variants) and add separator markers. Update unicode mappings (degree sign, invisible characters, conditional ∪ mapping, parallel/arrow glyphs) and adjust several function/operator braille outputs. Add/expand tests to cover functions, geometry, matrices and chemical formulas to validate the changes. * Add Russian language to docs Add Russian (ru) to the list of supported speech languages and update Russian documentation and translation guidance. - docs/User_guide_for_MathCAT_en.md, docs/index.md: add Russian (ru) to supported languages lists. - docs/ru/User_guide_for_MathCAT_ru.md: include Russian in language options, reorder entries and apply minor wording fixes. - docs/ru/helpers.md: clarify wording, update examples and test instructions to reference ru instead of fr, and improve translation guidance and examples (including test and cargo commands). - docs/ru/index.md: reorder supported languages and polish phrasing. These edits enable and document Russian support and improve clarity for translators and developers working on the Russian localization. * Refactor Russian function braille mapping Replace hardcoded function-name branches in Russian_Rules.yaml with a DefinitionValue lookup that pulls from a new RussianFunctionBraille mapping. Add RussianFunctionBraille entries to definitions.yaml (private-use codepoints U+E100–U+E10E) and map those codepoints to braille strings in unicode.yaml. Add a test covering tan/cot rendering. This centralizes function braille representations and simplifies the rule logic. * Refine Russian wording in translators guide Clarify and naturalize Russian phrasing in the translators guide: add explicit "на русском языке" to SimpleSpeak examples; change exponent wording to "в квадрате" with example "икс в квадрате"; make fraction wording more natural ("числитель разделить на знаменатель" and example "метр за секунду"); fix "английском" → "английском языке"; and update Braille tooling phrasing to "просмотрщиком Брайля" and "дисплее Брайля" for consistency. * Add alphabet indicators in russian_cleanup Insert a preprocessing step that injects braille alphabet indicators before running REPLACE_INDICATORS. A new helper add_russian_alphabet_indicators scans the raw braille and emits specific indicators for 'l' (Latin lowercase), 'u' (Latin uppercase), 'g' (Greek lowercase) and 'v' (Greek uppercase), avoiding repeated indicators by tracking the current alphabet mode. The helper also resets the mode on 'C', 'N', and '#'. This keeps the existing indicator replacement and space-collapsing logic intact while preventing redundant alphabet indicators. * Russian braille: add GOST symbols and decimals Add GOST-style number and symbol support for Russian braille: introduce a decimal-comma rule that emits BrailleChars for integer and fractional parts with a decimal indicator, using PUA digit placeholders. Extend unicode mappings with bracket/brace/slash/backslash/pipe characters, Celsius, context-sensitive prime (′/″) handling, PUA digit-to-braille mappings, and a few arrow/connective symbols. Update tests to cover decimal numbers, fractions, set notation, Celsius, and logical arrows, and adjust expected output for geometry primes to reflect the new context-aware prime handling. * Add vector/bar/arc mover rules and tests Introduce three new mover rules in Rules/Braille/Russian/Russian_Rules.yaml: vector-arrow, vector-bar, and geometry-arc. Each rule detects specific accent characters (arrows: → ⟶ ⇀ ⃗; bars: ¯ ‾ _  ̄; arcs: ⌒ ⏜ ︵) and emits the appropriate braille indicators, using a different form when the base has more than one character. Add corresponding tests in tests/braille/Russian/russian.rs to cover single- and multi-character movers and combined expressions. * Add Russian braille math functions and limits Extend Russian braille rules to support additional math functions and large operator limits. Added new rules for large-op-limits, operator/functions (including special handling for div), and div-specific replacements in Rules/Braille/Russian/*. Updated Russian definitions and unicode mappings to include sinh/cosh/tanh/coth, arg/sgn/det/rank/rg, Re/Im, grad/rot/div, gcd/lcm and related braille codes. Updated global Rules/definitions.yaml to recognize new function names. Fixed braille cleanup in src/braille.rs to normalize div encoding. Added unit tests exercising the new function mappings and large operator limits. * Support system left brace in Russian braille Introduce handling for system left-brace matrices in the Russian braille rules: add InSystemLeftBrace variable, a system-left-brace-opener rule and a system-left-brace-table rule to detect brace-enclosed mtable as a system. Update row-start logic to emit appropriate braille tokens when InSystemLeftBrace is set. Add tests exercising curly-brace matrices, piecewise function (brace with conditions), and vertical-bar matrices to verify the new behavior. * Add Russian chemistry braille rules and tests Extend Russian braille rules to handle chemical notation: add rules for equilibrium-arrow, reaction operators, repeated charges, charges, and charge-with-subscript mappings (chemical-reaction-operator, chemistry-mhchem-equilibrium-arrow, chemistry-repeated-charge, chemistry-charge, chemistry-charge-with-subscript). Update Rules/Braille/Russian/Russian_Rules.yaml to map arrows, +/-, superscripts/subscripts and reaction operators to appropriate braille sequences. Add tests in tests/braille/Russian/russian.rs (source_chemical_reactions_and_charges) covering reaction arrows, charges, subscripts/superscripts and combined examples. --------- Co-authored-by: Moritz Groß <hi@mgross.dev> Co-authored-by: nsoiffer <soiffer@alum.mit.edu> Co-authored-by: Tuomas Pyorre <82783219+ttpyorre@users.noreply.github.com> Co-authored-by: V3nky <venkatesh6114@gmail.com> Co-authored-by: Hon-Jang Yang <hjy1210@users.noreply.github.com> Co-authored-by: nsoiffer <neil.soiffer@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com>
NSoiffer
added a commit
that referenced
this pull request
Aug 3, 2026
… security fixes (#643) * First version of Russian Braille This commit adds first druft version for Russian Braille. * typo in example * Russian Braille fixes This commit adds fixes to Russian Braille. Now the test with parentheses is passed. Also there are devision and multiplication signs have been modified according to the Russian braille specs. * Braille - Latin and Greek letters fixes This commit adds a layer of Latin and Greek alphabets for Russian mathematical Braille. * In unicode.yaml Latin and Greek letters now go through the internal markers of the alphabetic mode. • In braille.rs russian_cleanup turns these markers into real signs: ◦ Latin lowercase: ⠠ ◦ Latin uppercase: ⠨ ◦ Greek lowercase: ⠰ ◦ Greek uppercase: ⠸ Added tests to russian.rs to x+A+y+B, the Latin letter after the number. * Braille - Roots, powers and scripts This commit adds Roots, powers and scripts according to the Russian math Braille specs. * Update Russian Braille rules and mappings Fix YAML replace syntax and extend Russian braille rules: add chemical-formula-operator-bond and prefix-geometry-ops rules, broaden function-name matching (include tg/ctg variants) and add separator markers. Update unicode mappings (degree sign, invisible characters, conditional ∪ mapping, parallel/arrow glyphs) and adjust several function/operator braille outputs. Add/expand tests to cover functions, geometry, matrices and chemical formulas to validate the changes. * Add Russian language to docs Add Russian (ru) to the list of supported speech languages and update Russian documentation and translation guidance. - docs/User_guide_for_MathCAT_en.md, docs/index.md: add Russian (ru) to supported languages lists. - docs/ru/User_guide_for_MathCAT_ru.md: include Russian in language options, reorder entries and apply minor wording fixes. - docs/ru/helpers.md: clarify wording, update examples and test instructions to reference ru instead of fr, and improve translation guidance and examples (including test and cargo commands). - docs/ru/index.md: reorder supported languages and polish phrasing. These edits enable and document Russian support and improve clarity for translators and developers working on the Russian localization. * Refactor Russian function braille mapping Replace hardcoded function-name branches in Russian_Rules.yaml with a DefinitionValue lookup that pulls from a new RussianFunctionBraille mapping. Add RussianFunctionBraille entries to definitions.yaml (private-use codepoints U+E100–U+E10E) and map those codepoints to braille strings in unicode.yaml. Add a test covering tan/cot rendering. This centralizes function braille representations and simplifies the rule logic. * Refine Russian wording in translators guide Clarify and naturalize Russian phrasing in the translators guide: add explicit "на русском языке" to SimpleSpeak examples; change exponent wording to "в квадрате" with example "икс в квадрате"; make fraction wording more natural ("числитель разделить на знаменатель" and example "метр за секунду"); fix "английском" → "английском языке"; and update Braille tooling phrasing to "просмотрщиком Брайля" and "дисплее Брайля" for consistency. * Addition of Russian documentation This commit adds Russian documentation for users, developers and translators. * First version of Russian Braille This commit adds first druft version for Russian Braille. * typo in example * Add alphabet indicators in russian_cleanup Insert a preprocessing step that injects braille alphabet indicators before running REPLACE_INDICATORS. A new helper add_russian_alphabet_indicators scans the raw braille and emits specific indicators for 'l' (Latin lowercase), 'u' (Latin uppercase), 'g' (Greek lowercase) and 'v' (Greek uppercase), avoiding repeated indicators by tracking the current alphabet mode. The helper also resets the mode on 'C', 'N', and '#'. This keeps the existing indicator replacement and space-collapsing logic intact while preventing redundant alphabet indicators. * Russian braille: add GOST symbols and decimals Add GOST-style number and symbol support for Russian braille: introduce a decimal-comma rule that emits BrailleChars for integer and fractional parts with a decimal indicator, using PUA digit placeholders. Extend unicode mappings with bracket/brace/slash/backslash/pipe characters, Celsius, context-sensitive prime (′/″) handling, PUA digit-to-braille mappings, and a few arrow/connective symbols. Update tests to cover decimal numbers, fractions, set notation, Celsius, and logical arrows, and adjust expected output for geometry primes to reflect the new context-aware prime handling. * Add vector/bar/arc mover rules and tests Introduce three new mover rules in Rules/Braille/Russian/Russian_Rules.yaml: vector-arrow, vector-bar, and geometry-arc. Each rule detects specific accent characters (arrows: → ⟶ ⇀ ⃗; bars: ¯ ‾ _  ̄; arcs: ⌒ ⏜ ︵) and emits the appropriate braille indicators, using a different form when the base has more than one character. Add corresponding tests in tests/braille/Russian/russian.rs to cover single- and multi-character movers and combined expressions. * Add Russian braille math functions and limits Extend Russian braille rules to support additional math functions and large operator limits. Added new rules for large-op-limits, operator/functions (including special handling for div), and div-specific replacements in Rules/Braille/Russian/*. Updated Russian definitions and unicode mappings to include sinh/cosh/tanh/coth, arg/sgn/det/rank/rg, Re/Im, grad/rot/div, gcd/lcm and related braille codes. Updated global Rules/definitions.yaml to recognize new function names. Fixed braille cleanup in src/braille.rs to normalize div encoding. Added unit tests exercising the new function mappings and large operator limits. * Support system left brace in Russian braille Introduce handling for system left-brace matrices in the Russian braille rules: add InSystemLeftBrace variable, a system-left-brace-opener rule and a system-left-brace-table rule to detect brace-enclosed mtable as a system. Update row-start logic to emit appropriate braille tokens when InSystemLeftBrace is set. Add tests exercising curly-brace matrices, piecewise function (brace with conditions), and vertical-bar matrices to verify the new behavior. * Add Russian chemistry braille rules and tests Extend Russian braille rules to handle chemical notation: add rules for equilibrium-arrow, reaction operators, repeated charges, charges, and charge-with-subscript mappings (chemical-reaction-operator, chemistry-mhchem-equilibrium-arrow, chemistry-repeated-charge, chemistry-charge, chemistry-charge-with-subscript). Update Rules/Braille/Russian/Russian_Rules.yaml to map arrows, +/-, superscripts/subscripts and reaction operators to appropriate braille sequences. Add tests in tests/braille/Russian/russian.rs (source_chemical_reactions_and_charges) covering reaction arrows, charges, subscripts/superscripts and combined examples. * Add signed-integer and nested-fraction rules Add handling for nested fractions and signed integers inside script positions and adjust grouping behavior for scripts in Russian braille rules. Changes introduce a nested-fraction rule for mfrac and new signed-integer-number / signed-integer rules for msub/munder and msup/mover, plus a small grouping test (⠐) when scripts contain grouped mrow with '+' or a fraction. Also add a comprehensive regression test (script_grouping_regressions) covering many sup/sub cases to ensure correct braille output. Files updated: Rules/Braille/Russian/Russian_Rules.yaml and tests/braille/Russian/russian.rs. * Enhance Russian Braille support with mathematical symbols and rules (#589) * Refine matrix rule handling by adding support for augmented matrices; update unit tests to include 2x3 and 3x4 augmented matrix scenarios. (#555) * remove logging statement * removed uneeded eprintlin!() * Alternative fix to PR #540. Fixes #528. Includes the tests in the PR. * Add Russian translation * Fix #585 -- SSML was being escaped. I earlier added code to prevent a SSML injection attack by escaping HTML. It was done at the wrong point and escape legal SSML. I have moved the check and conversion down to the leaves. I was very surprised there were no useful tests with SSML. All the main tests set `TTS=None`. I added a test that catches bad escaping. I also added some tests to check for leaf-based SSML attacks and also attribute-based ones. * bump beta number * The range for MATHEMATICAL SANS-SERIF DIGITs had MATHEMATICAL MONOSPACE DIGITs as the match part of translate, so if one of the sans-serif digits were used, you ended up in a loop (no match, to it returned itself). * comment out some debug statements * Add 02DA (˚) to list of circle-like chars -- I thought I had done this already, so it might in some other branch * Add source language option to translation audit tool Allow audit-translations to compare a target language against any source language via --source, defaulting to English for existing workflows. Update CLI output, docs, and tests for dynamic source/target labels, including Swedish/Norwegian comparison coverage. Normalize Rich ANSI output in tests so golden and string assertions remain stable when terminal color is forced. * fix ruff * fix ruff * fix ruff * Core concept names additions and tests -- issue 381 (#592) * initial addition of core concept names * defnitions and tests, with a few failing * minus, plus, volume fixes. Other defined, not appearing in site * fix clippy warnings * use "ruamel.yaml>=0.19.1" in uv.lock and pyproject.toml * handle canonicalize failure in containerized environments (#574) * add 1 week dependency cooldown for uv (#599) * fix rules for digits in german (#596) * update navigation rules for traditional chinese (#588) * copy english version of navigate.yaml from NVDA2026.1 and translate * 更新 definitions.yaml 與 navigate.yaml * update unicode-full.yaml * 區分完全/已完全放大/縮小 * 移至->移到, 表->表格, 數學式->數學, 退出->離開, 不能->無法, 當前->目前。 overview line 47, SimpleSpeak_Rules.yaml line 39, "根號"->""。mroot.rs 對應修改 * 移到上一格 -> 往上一格,移到下一格 -> 往下一格, 佔位符 -> 書籤,設定佔位符 -> 設定書籤,已是最上層 -> 不在別的式子裡面,上一層是 -> 在後面式子裡面,字元模式 開n 次方根 的讀法,基底 -> 基、底 * 向量 -> 射線 * 基 -> 基底,底 -> 基底 * Internally in definitions.yaml, MathCAT uses "nofix", but that's not a MathML airity property. Remove it. * don't say "indexed by", say "sub" * add some terse and verbose forms of speech * fix typo * Added an html file with all the test exprs so that translators have examples to test. * Fix remaining erros after `definitions.yaml` was updated -- needed to add `function:` * fix clippy warning * minor cleanup: remove ASCIIMath-fi reference * Refactor braille.rs to a BrailleCode trait + registry Replace the four scattered string-match dispatch sites (cleanup, get_braille_chars, NeedsToBeGrouped, and highlight knobs) with a single get_braille_code() registry and a BrailleCode trait implemented per code. Extract the duplicated UEB/Vietnam/Finnish/Swedish indicator-replacement closures into one apply_indicator_replacements helper plus a UserTypeforms struct. Behavior is unchanged (all tests/braille pass); adding a new code now means one registry entry + one impl block. Co-authored-by: Cursor <cursoragent@cursor.com> * improved counting for (likey) 8 bit codes when figuring out braille position * make sure this is part of repo * add BrailleDocs to repo (stop ignoring) * updated data, does not include ASCII letters/digits * First version of Russian Braille This commit adds first druft version for Russian Braille. * typo in example * Russian Braille fixes This commit adds fixes to Russian Braille. Now the test with parentheses is passed. Also there are devision and multiplication signs have been modified according to the Russian braille specs. * Braille - Latin and Greek letters fixes This commit adds a layer of Latin and Greek alphabets for Russian mathematical Braille. * In unicode.yaml Latin and Greek letters now go through the internal markers of the alphabetic mode. • In braille.rs russian_cleanup turns these markers into real signs: ◦ Latin lowercase: ⠠ ◦ Latin uppercase: ⠨ ◦ Greek lowercase: ⠰ ◦ Greek uppercase: ⠸ Added tests to russian.rs to x+A+y+B, the Latin letter after the number. * Braille - Roots, powers and scripts This commit adds Roots, powers and scripts according to the Russian math Braille specs. * Update Russian Braille rules and mappings Fix YAML replace syntax and extend Russian braille rules: add chemical-formula-operator-bond and prefix-geometry-ops rules, broaden function-name matching (include tg/ctg variants) and add separator markers. Update unicode mappings (degree sign, invisible characters, conditional ∪ mapping, parallel/arrow glyphs) and adjust several function/operator braille outputs. Add/expand tests to cover functions, geometry, matrices and chemical formulas to validate the changes. * Add Russian language to docs Add Russian (ru) to the list of supported speech languages and update Russian documentation and translation guidance. - docs/User_guide_for_MathCAT_en.md, docs/index.md: add Russian (ru) to supported languages lists. - docs/ru/User_guide_for_MathCAT_ru.md: include Russian in language options, reorder entries and apply minor wording fixes. - docs/ru/helpers.md: clarify wording, update examples and test instructions to reference ru instead of fr, and improve translation guidance and examples (including test and cargo commands). - docs/ru/index.md: reorder supported languages and polish phrasing. These edits enable and document Russian support and improve clarity for translators and developers working on the Russian localization. * Refactor Russian function braille mapping Replace hardcoded function-name branches in Russian_Rules.yaml with a DefinitionValue lookup that pulls from a new RussianFunctionBraille mapping. Add RussianFunctionBraille entries to definitions.yaml (private-use codepoints U+E100–U+E10E) and map those codepoints to braille strings in unicode.yaml. Add a test covering tan/cot rendering. This centralizes function braille representations and simplifies the rule logic. * Refine Russian wording in translators guide Clarify and naturalize Russian phrasing in the translators guide: add explicit "на русском языке" to SimpleSpeak examples; change exponent wording to "в квадрате" with example "икс в квадрате"; make fraction wording more natural ("числитель разделить на знаменатель" and example "метр за секунду"); fix "английском" → "английском языке"; and update Braille tooling phrasing to "просмотрщиком Брайля" and "дисплее Брайля" for consistency. * Add alphabet indicators in russian_cleanup Insert a preprocessing step that injects braille alphabet indicators before running REPLACE_INDICATORS. A new helper add_russian_alphabet_indicators scans the raw braille and emits specific indicators for 'l' (Latin lowercase), 'u' (Latin uppercase), 'g' (Greek lowercase) and 'v' (Greek uppercase), avoiding repeated indicators by tracking the current alphabet mode. The helper also resets the mode on 'C', 'N', and '#'. This keeps the existing indicator replacement and space-collapsing logic intact while preventing redundant alphabet indicators. * Russian braille: add GOST symbols and decimals Add GOST-style number and symbol support for Russian braille: introduce a decimal-comma rule that emits BrailleChars for integer and fractional parts with a decimal indicator, using PUA digit placeholders. Extend unicode mappings with bracket/brace/slash/backslash/pipe characters, Celsius, context-sensitive prime (′/″) handling, PUA digit-to-braille mappings, and a few arrow/connective symbols. Update tests to cover decimal numbers, fractions, set notation, Celsius, and logical arrows, and adjust expected output for geometry primes to reflect the new context-aware prime handling. * Add vector/bar/arc mover rules and tests Introduce three new mover rules in Rules/Braille/Russian/Russian_Rules.yaml: vector-arrow, vector-bar, and geometry-arc. Each rule detects specific accent characters (arrows: → ⟶ ⇀ ⃗; bars: ¯ ‾ _  ̄; arcs: ⌒ ⏜ ︵) and emits the appropriate braille indicators, using a different form when the base has more than one character. Add corresponding tests in tests/braille/Russian/russian.rs to cover single- and multi-character movers and combined expressions. * Add Russian braille math functions and limits Extend Russian braille rules to support additional math functions and large operator limits. Added new rules for large-op-limits, operator/functions (including special handling for div), and div-specific replacements in Rules/Braille/Russian/*. Updated Russian definitions and unicode mappings to include sinh/cosh/tanh/coth, arg/sgn/det/rank/rg, Re/Im, grad/rot/div, gcd/lcm and related braille codes. Updated global Rules/definitions.yaml to recognize new function names. Fixed braille cleanup in src/braille.rs to normalize div encoding. Added unit tests exercising the new function mappings and large operator limits. * Support system left brace in Russian braille Introduce handling for system left-brace matrices in the Russian braille rules: add InSystemLeftBrace variable, a system-left-brace-opener rule and a system-left-brace-table rule to detect brace-enclosed mtable as a system. Update row-start logic to emit appropriate braille tokens when InSystemLeftBrace is set. Add tests exercising curly-brace matrices, piecewise function (brace with conditions), and vertical-bar matrices to verify the new behavior. * Add Russian chemistry braille rules and tests Extend Russian braille rules to handle chemical notation: add rules for equilibrium-arrow, reaction operators, repeated charges, charges, and charge-with-subscript mappings (chemical-reaction-operator, chemistry-mhchem-equilibrium-arrow, chemistry-repeated-charge, chemistry-charge, chemistry-charge-with-subscript). Update Rules/Braille/Russian/Russian_Rules.yaml to map arrows, +/-, superscripts/subscripts and reaction operators to appropriate braille sequences. Add tests in tests/braille/Russian/russian.rs (source_chemical_reactions_and_charges) covering reaction arrows, charges, subscripts/superscripts and combined examples. --------- Co-authored-by: Moritz Groß <hi@mgross.dev> Co-authored-by: nsoiffer <soiffer@alum.mit.edu> Co-authored-by: Tuomas Pyorre <82783219+ttpyorre@users.noreply.github.com> Co-authored-by: V3nky <venkatesh6114@gmail.com> Co-authored-by: Hon-Jang Yang <hjy1210@users.noreply.github.com> Co-authored-by: nsoiffer <neil.soiffer@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com> * Add Russian braille label marks and tests Introduce comprehensive Russian braille label handling: new label/mark rules (exact-over/under, upper/lower-right, repeated/no-indicator, left-labels) and mmultiscripts prescript/postscript logic in Rules/Braille/Russian/Russian_Rules.yaml. Add Unicode braille mappings and new definition maps (RussianLabelMarks, RussianExactOverLabelMarksWithoutIndicator, RussianUpperRightLabelMarksWithoutIndicator) in definitions.yaml and unicode.yaml, and change '%' mapping. Expand tests (tests/braille/Russian/russian.rs) with cases for percent/special marks, labeled table rows, mmultiscripts variants, digit sequences, infinity index, complex sup fractions and many label-mark expectations. * Add Russian braille support for periodic decimals and mixed numbers Add braille rules for rendering periodic (repeating) decimals like 0,4(71) and mixed numbers with simple/arithmetic fractions in Russian. Includes regex cleanup to remove redundant number indicators in periodic decimal portions and comprehensive test coverage. * Add Russian braille rules for geometry operators Add three new braille encoding rules for geometry operators (∠, △, ∪) in Russian: - canonical-prefix-geometry-op: handles geometry operators in canonical form - geometry-prefix-after-canonical-multiplier: handles operators after canonical multipliers - geometry-prefix-after-multiplier: handles operators after regular multipliers Includes corresponding test cases for angles, triangles, unions, perpendicular, and similar symbols. * Adjust Russian braille union handling and add tests Move the special-case braille for the union operator out of the global unicode map and into the Russian rule that handles geometric prefix usage, and tighten the rule match to only trigger when preceded by a number. Update unicode.yaml to a consistent union mapping. Add unit tests covering set relations (∈, ∉, ⊂, ⊄, ∩, ∪), empty set, and quantifiers (∀, ∃) plus geometry/operator cases to validate the new behavior. Files changed: Rules/Braille/Russian/Russian_Rules.yaml, Rules/Braille/Russian/unicode.yaml, tests/braille/Russian/russian.rs * Improve Russian braille typeform and mathvariant handling Refactor Russian braille cleanup to properly handle typeform indicators (bold, italic) and mathvariant attributes. Introduces a dedicated typeform indicator function that manages indicator placement according to Russian Braille ГОСТ Р 58511 standard, separating typeform handling from alphabet indicators. Adds support for automatic typeform indicators based on mathvariant attributes, ensuring proper indicator pairing around content blocks. Updates unicode-full.yaml rules to reflect new typeform codes and adds comprehensive tests for various mathvariant combinations. * Add Russian Braille chemistry notation rules Add support for chemical equations in Russian Braille, including: - Single-letter element group notation with prefix marker ⠸ - Reaction arrow handling for mover, munder, and munderover (above, below, above-and-below) - Improved chemical element rendering with InChemElementGroup context variable Includes comprehensive test cases for various chemical formula patterns and reaction arrow configurations. * Add Russian braille mappings and tests Update Russian braille symbol map and extend tests. Rules/Braille/Russian/unicode.yaml: add mappings for №, §, …, ↵, ⏎ and ⍰. tests/braille/Russian/russian.rs: add source_general_math_text_rules unit (covers №, §, ellipsis, return symbols and mixed expressions) and a roman-numeral Latin-indicator test. Ensures MathCAT produces expected braille outputs for these symbols and cases. * Add column arithmetic and enhance Russian braille rules Adds support for column arithmetic formatting with dedicated rules for operators and continuation numbers. Improves fraction rendering for negative denominators and decimal numbers. Enhances trigonometric function handling with power notation and mixed subscript/superscript support. Adds comprehensive tests covering column arithmetic, thin fractions, indexes, and various mathematical constructs. * Optimize braille string operations for single chars Replace push_str() and insert_str() calls with more efficient push() and insert() methods when operating on single Braille characters. This is more idiomatic Rust and avoids unnecessary string allocation overhead. * Verify RU speech strings; add nav & unit rules Convert many Russian speech entries from t: to T: (marking translations as verified) across SharedRules (calculus, geometry, linear-algebra, overview, etc.). Add new RU rules: power-indexed-by, unit-terse, a currency placeholder, and several navigation parity/placeholder rules (into-or-out-of-*, zoom-in-*, move-next/prev-character, and related none/mprescripts entries). Normalize some tag values (none without quotes). Most new navigation/currency rules use match: false() to preserve existing runtime behavior while providing parity with English rules. * Add Russian braille rules for geometry accents Add braille transcription rules for Russian geometry notation with over/under accents: - geometry-line-double-arrow: handles double-arrow symbols (↔⟷) in mover - lower-vector-arrow: handles vector arrows (→⟶⇀⃗) in munder - lower-geometry-line-double-arrow: handles double-arrow symbols in munder - lower-vector-bar: handles bar accents (¯‾_ ̄) in munder Includes corresponding test cases for measurements, physical quantities, and geometry notation. * Add vector and long-division Russian braille rules Add braille rules for vector notation (arrow, bar, and double-arrow postfix operators) and long-division formatting in Russian. Includes support for system braces and new test cases covering vector notation in geometry, long-division examples, and less common mathematical symbols. * Add postscripts and new label marks for Russian Braille Enhance mmultiscripts rule to handle postscripts (subscripts/superscripts after base element) in addition to prescripts. Add new character mappings for '?' and '←' symbols as label marks in Russian Braille. Includes comprehensive test coverage for the new functionality. * Fix Russian percent braille and add per mille sign Simplify the Russian braille representation for the percent sign (%) by removing the middle dot, and add support for the per mille sign (‰) with its braille representation. Updates corresponding test cases. * Propagate mathvariant attribute to children Add mathvariant inheritance from parent elements to children that lack their own mathvariant attribute. This ensures consistent styling throughout nested elements. Includes tests for bold text propagation through mstyle and mrow containers, and verifies that explicit child mathvariants override inherited values. * Fix clippy warnings and improve code style - Remove unnecessary borrows in format! and display calls - Change string slices to arrays in trim_end_matches calls - Replace expect(&format!(...)) with unwrap_or_else(|_| panic!(...)) - Add clippy allow attributes to suppress false positives in tests - Add missing newline at end of build.rs * Remove unnecessary borrows in format macros Remove redundant `&` reference operators from arguments passed to format! macros and similar functions. These values are automatically borrowed by the format machinery, so explicit borrows are unnecessary and reduce readability. * Normalize Unicode math digits in decimal numbers Add normalization of Unicode mathematical alphanumeric symbols (Plane 1 digits) to ASCII digits for number nodes containing decimal points. Skip canonicalize_plane1 processing for already-normalized nodes to prevent double processing. * Remove unnecessary references and .to_string() calls Remove unnecessary `&` borrows in format arguments and replace `.to_string()` with direct display. Simplify byte array literals to byte string literals for readability and idiomatic Rust style. * Remove mathvariant propagation and update tests Drop implicit propagation of the mathvariant attribute from canonicalization (removed propagate_inherited_mathvariant call and helper functions) and update Russian braille tests to set mathvariant explicitly on elements (replace mstyle with mrow and move attributes to mi). Changes in src/canonicalize.rs and tests/braille/Russian/russian.rs. This makes mathvariant handling explicit in tests and avoids mutating child nodes during canonicalization. * Remove math digit normalization for mn nodes Delete the conditional normalization of mathematical digit characters for <mn> text and remove the normalize_math_digits helper from src/canonicalize.rs. Previously the code converted several Unicode math-digit codepoints to ASCII when a decimal point was present. * Split Russian braille tests into individual cases Introduce test_russian_braille helper and refactor tests/braille/Russian/russian.rs to replace large grouped tests with many small, named #[test] functions. The change splits combined test vectors and loops (e.g. script_grouping_regressions and other multi-assertion tests) into individual test cases for improved isolation and clearer failures. * Adjust test expectations and unignore tests Update expected spoken/braille test outputs across multiple language test files to match updated speech rules (punctuation handling, table phrasing, and unit/roman-numeral rendering). Removed several #[ignore] annotations for the previously skipped "ignore_period_and_space" tests. Minor tidy in pl/definitions.rs to avoid unnecessary format! usage and fix EOF newline. Affected files include tests/Languages/* for en, fi, fr, hu, nb, pl, sv, vi, and zh/tw. * Bump to 0.7.6-beta.8 and update dependencies Update to version 0.7.6-beta.8 with the following changes: - Migrate to no-unsafe variants of sxd-document and sxd-xpath - Add 'no-unsafe' feature flag for unsafe-free builds - Update dependencies: strum, regex, bitflags, env_logger - Add tempfile dev-dependency - Improve build.rs: add rerun-if-changed directives earlier and fix indentation - Exclude BrailleDocs from package * Switch to sxd_document_no_unsafe and NameStr Replace sxd_document/sxd_xpath usages with no-unsafe variants and adapt string types. Key changes in src/braille.rs, src/canonicalize.rs, and src/chemistry.rs: introduce NameStr (feature-gated), use as_str!/as_qname! helpers, convert many attribute_value calls to .as_deref(), update XPath error constructions, and store operator chars as NameStr with PhantomData in OperatorPair. Refactor chemistry tests to helper-based Result flow and use sxd_document_no_unsafe::parser. These edits make the code compatible with the "no-unsafe" pathway and fix lifetime/string mismatches across the codebase. * Use no-unsafe sxd crates; adapt code & tests Replace sxd_document/sxd_xpath with sxd_document_no_unsafe and sxd_xpath_no_unsafe and update imports (including parser). Adjust attribute handling and lifetimes: use as_str!, attribute_value(...).as_deref().unwrap_or_default(), and similar changes to avoid unsafe string lifetimes. Refactor tests to return Result, use ? and panic-catching, and update assertions (e.g. is_empty). Re-enable sample MathML in main, tweak timing_test (disable heavy loops, change loop count). Misc small fixes to satisfy the new APIs and lifetime semantics. * Use no-unsafe sxd libs; refactor TTS & parsing Switch project XML/XPath handling to sxd_document_no_unsafe / sxd_xpath_no_unsafe and adapt code to use as_str!/as_qname! helpers. Update speech and pretty-print logic to use the new context and node APIs, tighten unicode handling, and add debug checks. Refactor TTS APIs so command value accessors return Result and TTS string builders propagate errors. Update tests and prefs helpers (temporary rules dir helper, prefs test flow). Misc: small capacity tweaks and wording fixes in error messages. Files changed: src/prefs.rs, src/pretty_print.rs, src/speech.rs, src/tts.rs. --------- Co-authored-by: nsoiffer <soiffer@alum.mit.edu> Co-authored-by: Moritz Groß <hi@mgross.dev> Co-authored-by: Tuomas Pyorre <82783219+ttpyorre@users.noreply.github.com> Co-authored-by: V3nky <venkatesh6114@gmail.com> Co-authored-by: Hon-Jang Yang <hjy1210@users.noreply.github.com> Co-authored-by: nsoiffer <neil.soiffer@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: NSoiffer <NSoiffer@users.noreply.github.com>
Kostenkov-2021
added a commit
to Kostenkov-2021/MathCAT
that referenced
this pull request
Aug 6, 2026
…aisy#589) * Refine matrix rule handling by adding support for augmented matrices; update unit tests to include 2x3 and 3x4 augmented matrix scenarios. (daisy#555) * remove logging statement * removed uneeded eprintlin!() * Alternative fix to PR daisy#540. Fixes daisy#528. Includes the tests in the PR. * Add Russian translation * Fix daisy#585 -- SSML was being escaped. I earlier added code to prevent a SSML injection attack by escaping HTML. It was done at the wrong point and escape legal SSML. I have moved the check and conversion down to the leaves. I was very surprised there were no useful tests with SSML. All the main tests set `TTS=None`. I added a test that catches bad escaping. I also added some tests to check for leaf-based SSML attacks and also attribute-based ones. * bump beta number * The range for MATHEMATICAL SANS-SERIF DIGITs had MATHEMATICAL MONOSPACE DIGITs as the match part of translate, so if one of the sans-serif digits were used, you ended up in a loop (no match, to it returned itself). * comment out some debug statements * Add 02DA (˚) to list of circle-like chars -- I thought I had done this already, so it might in some other branch * Add source language option to translation audit tool Allow audit-translations to compare a target language against any source language via --source, defaulting to English for existing workflows. Update CLI output, docs, and tests for dynamic source/target labels, including Swedish/Norwegian comparison coverage. Normalize Rich ANSI output in tests so golden and string assertions remain stable when terminal color is forced. * fix ruff * fix ruff * fix ruff * Core concept names additions and tests -- issue 381 (daisy#592) * initial addition of core concept names * defnitions and tests, with a few failing * minus, plus, volume fixes. Other defined, not appearing in site * fix clippy warnings * use "ruamel.yaml>=0.19.1" in uv.lock and pyproject.toml * handle canonicalize failure in containerized environments (daisy#574) * add 1 week dependency cooldown for uv (daisy#599) * fix rules for digits in german (daisy#596) * update navigation rules for traditional chinese (daisy#588) * copy english version of navigate.yaml from NVDA2026.1 and translate * 更新 definitions.yaml 與 navigate.yaml * update unicode-full.yaml * 區分完全/已完全放大/縮小 * 移至->移到, 表->表格, 數學式->數學, 退出->離開, 不能->無法, 當前->目前。 overview line 47, SimpleSpeak_Rules.yaml line 39, "根號"->""。mroot.rs 對應修改 * 移到上一格 -> 往上一格,移到下一格 -> 往下一格, 佔位符 -> 書籤,設定佔位符 -> 設定書籤,已是最上層 -> 不在別的式子裡面,上一層是 -> 在後面式子裡面,字元模式 開n 次方根 的讀法,基底 -> 基、底 * 向量 -> 射線 * 基 -> 基底,底 -> 基底 * Internally in definitions.yaml, MathCAT uses "nofix", but that's not a MathML airity property. Remove it. * don't say "indexed by", say "sub" * add some terse and verbose forms of speech * fix typo * Added an html file with all the test exprs so that translators have examples to test. * Fix remaining erros after `definitions.yaml` was updated -- needed to add `function:` * fix clippy warning * minor cleanup: remove ASCIIMath-fi reference * Refactor braille.rs to a BrailleCode trait + registry Replace the four scattered string-match dispatch sites (cleanup, get_braille_chars, NeedsToBeGrouped, and highlight knobs) with a single get_braille_code() registry and a BrailleCode trait implemented per code. Extract the duplicated UEB/Vietnam/Finnish/Swedish indicator-replacement closures into one apply_indicator_replacements helper plus a UserTypeforms struct. Behavior is unchanged (all tests/braille pass); adding a new code now means one registry entry + one impl block. Co-authored-by: Cursor <cursoragent@cursor.com> * improved counting for (likey) 8 bit codes when figuring out braille position * make sure this is part of repo * add BrailleDocs to repo (stop ignoring) * updated data, does not include ASCII letters/digits * First version of Russian Braille This commit adds first druft version for Russian Braille. * typo in example * Russian Braille fixes This commit adds fixes to Russian Braille. Now the test with parentheses is passed. Also there are devision and multiplication signs have been modified according to the Russian braille specs. * Braille - Latin and Greek letters fixes This commit adds a layer of Latin and Greek alphabets for Russian mathematical Braille. * In unicode.yaml Latin and Greek letters now go through the internal markers of the alphabetic mode. • In braille.rs russian_cleanup turns these markers into real signs: ◦ Latin lowercase: ⠠ ◦ Latin uppercase: ⠨ ◦ Greek lowercase: ⠰ ◦ Greek uppercase: ⠸ Added tests to russian.rs to x+A+y+B, the Latin letter after the number. * Braille - Roots, powers and scripts This commit adds Roots, powers and scripts according to the Russian math Braille specs. * Update Russian Braille rules and mappings Fix YAML replace syntax and extend Russian braille rules: add chemical-formula-operator-bond and prefix-geometry-ops rules, broaden function-name matching (include tg/ctg variants) and add separator markers. Update unicode mappings (degree sign, invisible characters, conditional ∪ mapping, parallel/arrow glyphs) and adjust several function/operator braille outputs. Add/expand tests to cover functions, geometry, matrices and chemical formulas to validate the changes. * Add Russian language to docs Add Russian (ru) to the list of supported speech languages and update Russian documentation and translation guidance. - docs/User_guide_for_MathCAT_en.md, docs/index.md: add Russian (ru) to supported languages lists. - docs/ru/User_guide_for_MathCAT_ru.md: include Russian in language options, reorder entries and apply minor wording fixes. - docs/ru/helpers.md: clarify wording, update examples and test instructions to reference ru instead of fr, and improve translation guidance and examples (including test and cargo commands). - docs/ru/index.md: reorder supported languages and polish phrasing. These edits enable and document Russian support and improve clarity for translators and developers working on the Russian localization. * Refactor Russian function braille mapping Replace hardcoded function-name branches in Russian_Rules.yaml with a DefinitionValue lookup that pulls from a new RussianFunctionBraille mapping. Add RussianFunctionBraille entries to definitions.yaml (private-use codepoints U+E100–U+E10E) and map those codepoints to braille strings in unicode.yaml. Add a test covering tan/cot rendering. This centralizes function braille representations and simplifies the rule logic. * Refine Russian wording in translators guide Clarify and naturalize Russian phrasing in the translators guide: add explicit "на русском языке" to SimpleSpeak examples; change exponent wording to "в квадрате" with example "икс в квадрате"; make fraction wording more natural ("числитель разделить на знаменатель" and example "метр за секунду"); fix "английском" → "английском языке"; and update Braille tooling phrasing to "просмотрщиком Брайля" and "дисплее Брайля" for consistency. * Add alphabet indicators in russian_cleanup Insert a preprocessing step that injects braille alphabet indicators before running REPLACE_INDICATORS. A new helper add_russian_alphabet_indicators scans the raw braille and emits specific indicators for 'l' (Latin lowercase), 'u' (Latin uppercase), 'g' (Greek lowercase) and 'v' (Greek uppercase), avoiding repeated indicators by tracking the current alphabet mode. The helper also resets the mode on 'C', 'N', and '#'. This keeps the existing indicator replacement and space-collapsing logic intact while preventing redundant alphabet indicators. * Russian braille: add GOST symbols and decimals Add GOST-style number and symbol support for Russian braille: introduce a decimal-comma rule that emits BrailleChars for integer and fractional parts with a decimal indicator, using PUA digit placeholders. Extend unicode mappings with bracket/brace/slash/backslash/pipe characters, Celsius, context-sensitive prime (′/″) handling, PUA digit-to-braille mappings, and a few arrow/connective symbols. Update tests to cover decimal numbers, fractions, set notation, Celsius, and logical arrows, and adjust expected output for geometry primes to reflect the new context-aware prime handling. * Add vector/bar/arc mover rules and tests Introduce three new mover rules in Rules/Braille/Russian/Russian_Rules.yaml: vector-arrow, vector-bar, and geometry-arc. Each rule detects specific accent characters (arrows: → ⟶ ⇀ ⃗; bars: ¯ ‾ _  ̄; arcs: ⌒ ⏜ ︵) and emits the appropriate braille indicators, using a different form when the base has more than one character. Add corresponding tests in tests/braille/Russian/russian.rs to cover single- and multi-character movers and combined expressions. * Add Russian braille math functions and limits Extend Russian braille rules to support additional math functions and large operator limits. Added new rules for large-op-limits, operator/functions (including special handling for div), and div-specific replacements in Rules/Braille/Russian/*. Updated Russian definitions and unicode mappings to include sinh/cosh/tanh/coth, arg/sgn/det/rank/rg, Re/Im, grad/rot/div, gcd/lcm and related braille codes. Updated global Rules/definitions.yaml to recognize new function names. Fixed braille cleanup in src/braille.rs to normalize div encoding. Added unit tests exercising the new function mappings and large operator limits. * Support system left brace in Russian braille Introduce handling for system left-brace matrices in the Russian braille rules: add InSystemLeftBrace variable, a system-left-brace-opener rule and a system-left-brace-table rule to detect brace-enclosed mtable as a system. Update row-start logic to emit appropriate braille tokens when InSystemLeftBrace is set. Add tests exercising curly-brace matrices, piecewise function (brace with conditions), and vertical-bar matrices to verify the new behavior. * Add Russian chemistry braille rules and tests Extend Russian braille rules to handle chemical notation: add rules for equilibrium-arrow, reaction operators, repeated charges, charges, and charge-with-subscript mappings (chemical-reaction-operator, chemistry-mhchem-equilibrium-arrow, chemistry-repeated-charge, chemistry-charge, chemistry-charge-with-subscript). Update Rules/Braille/Russian/Russian_Rules.yaml to map arrows, +/-, superscripts/subscripts and reaction operators to appropriate braille sequences. Add tests in tests/braille/Russian/russian.rs (source_chemical_reactions_and_charges) covering reaction arrows, charges, subscripts/superscripts and combined examples. --------- Co-authored-by: Moritz Groß <hi@mgross.dev> Co-authored-by: nsoiffer <soiffer@alum.mit.edu> Co-authored-by: Tuomas Pyorre <82783219+ttpyorre@users.noreply.github.com> Co-authored-by: V3nky <venkatesh6114@gmail.com> Co-authored-by: Hon-Jang Yang <hjy1210@users.noreply.github.com> Co-authored-by: nsoiffer <neil.soiffer@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Kostenkov-2021
added a commit
to Kostenkov-2021/MathCAT
that referenced
this pull request
Aug 7, 2026
…aisy#589) * Refine matrix rule handling by adding support for augmented matrices; update unit tests to include 2x3 and 3x4 augmented matrix scenarios. (daisy#555) * remove logging statement * removed uneeded eprintlin!() * Alternative fix to PR daisy#540. Fixes daisy#528. Includes the tests in the PR. * Add Russian translation * Fix daisy#585 -- SSML was being escaped. I earlier added code to prevent a SSML injection attack by escaping HTML. It was done at the wrong point and escape legal SSML. I have moved the check and conversion down to the leaves. I was very surprised there were no useful tests with SSML. All the main tests set `TTS=None`. I added a test that catches bad escaping. I also added some tests to check for leaf-based SSML attacks and also attribute-based ones. * bump beta number * The range for MATHEMATICAL SANS-SERIF DIGITs had MATHEMATICAL MONOSPACE DIGITs as the match part of translate, so if one of the sans-serif digits were used, you ended up in a loop (no match, to it returned itself). * comment out some debug statements * Add 02DA (˚) to list of circle-like chars -- I thought I had done this already, so it might in some other branch * Add source language option to translation audit tool Allow audit-translations to compare a target language against any source language via --source, defaulting to English for existing workflows. Update CLI output, docs, and tests for dynamic source/target labels, including Swedish/Norwegian comparison coverage. Normalize Rich ANSI output in tests so golden and string assertions remain stable when terminal color is forced. * fix ruff * fix ruff * fix ruff * Core concept names additions and tests -- issue 381 (daisy#592) * initial addition of core concept names * defnitions and tests, with a few failing * minus, plus, volume fixes. Other defined, not appearing in site * fix clippy warnings * use "ruamel.yaml>=0.19.1" in uv.lock and pyproject.toml * handle canonicalize failure in containerized environments (daisy#574) * add 1 week dependency cooldown for uv (daisy#599) * fix rules for digits in german (daisy#596) * update navigation rules for traditional chinese (daisy#588) * copy english version of navigate.yaml from NVDA2026.1 and translate * 更新 definitions.yaml 與 navigate.yaml * update unicode-full.yaml * 區分完全/已完全放大/縮小 * 移至->移到, 表->表格, 數學式->數學, 退出->離開, 不能->無法, 當前->目前。 overview line 47, SimpleSpeak_Rules.yaml line 39, "根號"->""。mroot.rs 對應修改 * 移到上一格 -> 往上一格,移到下一格 -> 往下一格, 佔位符 -> 書籤,設定佔位符 -> 設定書籤,已是最上層 -> 不在別的式子裡面,上一層是 -> 在後面式子裡面,字元模式 開n 次方根 的讀法,基底 -> 基、底 * 向量 -> 射線 * 基 -> 基底,底 -> 基底 * Internally in definitions.yaml, MathCAT uses "nofix", but that's not a MathML airity property. Remove it. * don't say "indexed by", say "sub" * add some terse and verbose forms of speech * fix typo * Added an html file with all the test exprs so that translators have examples to test. * Fix remaining erros after `definitions.yaml` was updated -- needed to add `function:` * fix clippy warning * minor cleanup: remove ASCIIMath-fi reference * Refactor braille.rs to a BrailleCode trait + registry Replace the four scattered string-match dispatch sites (cleanup, get_braille_chars, NeedsToBeGrouped, and highlight knobs) with a single get_braille_code() registry and a BrailleCode trait implemented per code. Extract the duplicated UEB/Vietnam/Finnish/Swedish indicator-replacement closures into one apply_indicator_replacements helper plus a UserTypeforms struct. Behavior is unchanged (all tests/braille pass); adding a new code now means one registry entry + one impl block. Co-authored-by: Cursor <cursoragent@cursor.com> * improved counting for (likey) 8 bit codes when figuring out braille position * make sure this is part of repo * add BrailleDocs to repo (stop ignoring) * updated data, does not include ASCII letters/digits * First version of Russian Braille This commit adds first druft version for Russian Braille. * typo in example * Russian Braille fixes This commit adds fixes to Russian Braille. Now the test with parentheses is passed. Also there are devision and multiplication signs have been modified according to the Russian braille specs. * Braille - Latin and Greek letters fixes This commit adds a layer of Latin and Greek alphabets for Russian mathematical Braille. * In unicode.yaml Latin and Greek letters now go through the internal markers of the alphabetic mode. • In braille.rs russian_cleanup turns these markers into real signs: ◦ Latin lowercase: ⠠ ◦ Latin uppercase: ⠨ ◦ Greek lowercase: ⠰ ◦ Greek uppercase: ⠸ Added tests to russian.rs to x+A+y+B, the Latin letter after the number. * Braille - Roots, powers and scripts This commit adds Roots, powers and scripts according to the Russian math Braille specs. * Update Russian Braille rules and mappings Fix YAML replace syntax and extend Russian braille rules: add chemical-formula-operator-bond and prefix-geometry-ops rules, broaden function-name matching (include tg/ctg variants) and add separator markers. Update unicode mappings (degree sign, invisible characters, conditional ∪ mapping, parallel/arrow glyphs) and adjust several function/operator braille outputs. Add/expand tests to cover functions, geometry, matrices and chemical formulas to validate the changes. * Add Russian language to docs Add Russian (ru) to the list of supported speech languages and update Russian documentation and translation guidance. - docs/User_guide_for_MathCAT_en.md, docs/index.md: add Russian (ru) to supported languages lists. - docs/ru/User_guide_for_MathCAT_ru.md: include Russian in language options, reorder entries and apply minor wording fixes. - docs/ru/helpers.md: clarify wording, update examples and test instructions to reference ru instead of fr, and improve translation guidance and examples (including test and cargo commands). - docs/ru/index.md: reorder supported languages and polish phrasing. These edits enable and document Russian support and improve clarity for translators and developers working on the Russian localization. * Refactor Russian function braille mapping Replace hardcoded function-name branches in Russian_Rules.yaml with a DefinitionValue lookup that pulls from a new RussianFunctionBraille mapping. Add RussianFunctionBraille entries to definitions.yaml (private-use codepoints U+E100–U+E10E) and map those codepoints to braille strings in unicode.yaml. Add a test covering tan/cot rendering. This centralizes function braille representations and simplifies the rule logic. * Refine Russian wording in translators guide Clarify and naturalize Russian phrasing in the translators guide: add explicit "на русском языке" to SimpleSpeak examples; change exponent wording to "в квадрате" with example "икс в квадрате"; make fraction wording more natural ("числитель разделить на знаменатель" and example "метр за секунду"); fix "английском" → "английском языке"; and update Braille tooling phrasing to "просмотрщиком Брайля" and "дисплее Брайля" for consistency. * Add alphabet indicators in russian_cleanup Insert a preprocessing step that injects braille alphabet indicators before running REPLACE_INDICATORS. A new helper add_russian_alphabet_indicators scans the raw braille and emits specific indicators for 'l' (Latin lowercase), 'u' (Latin uppercase), 'g' (Greek lowercase) and 'v' (Greek uppercase), avoiding repeated indicators by tracking the current alphabet mode. The helper also resets the mode on 'C', 'N', and '#'. This keeps the existing indicator replacement and space-collapsing logic intact while preventing redundant alphabet indicators. * Russian braille: add GOST symbols and decimals Add GOST-style number and symbol support for Russian braille: introduce a decimal-comma rule that emits BrailleChars for integer and fractional parts with a decimal indicator, using PUA digit placeholders. Extend unicode mappings with bracket/brace/slash/backslash/pipe characters, Celsius, context-sensitive prime (′/″) handling, PUA digit-to-braille mappings, and a few arrow/connective symbols. Update tests to cover decimal numbers, fractions, set notation, Celsius, and logical arrows, and adjust expected output for geometry primes to reflect the new context-aware prime handling. * Add vector/bar/arc mover rules and tests Introduce three new mover rules in Rules/Braille/Russian/Russian_Rules.yaml: vector-arrow, vector-bar, and geometry-arc. Each rule detects specific accent characters (arrows: → ⟶ ⇀ ⃗; bars: ¯ ‾ _  ̄; arcs: ⌒ ⏜ ︵) and emits the appropriate braille indicators, using a different form when the base has more than one character. Add corresponding tests in tests/braille/Russian/russian.rs to cover single- and multi-character movers and combined expressions. * Add Russian braille math functions and limits Extend Russian braille rules to support additional math functions and large operator limits. Added new rules for large-op-limits, operator/functions (including special handling for div), and div-specific replacements in Rules/Braille/Russian/*. Updated Russian definitions and unicode mappings to include sinh/cosh/tanh/coth, arg/sgn/det/rank/rg, Re/Im, grad/rot/div, gcd/lcm and related braille codes. Updated global Rules/definitions.yaml to recognize new function names. Fixed braille cleanup in src/braille.rs to normalize div encoding. Added unit tests exercising the new function mappings and large operator limits. * Support system left brace in Russian braille Introduce handling for system left-brace matrices in the Russian braille rules: add InSystemLeftBrace variable, a system-left-brace-opener rule and a system-left-brace-table rule to detect brace-enclosed mtable as a system. Update row-start logic to emit appropriate braille tokens when InSystemLeftBrace is set. Add tests exercising curly-brace matrices, piecewise function (brace with conditions), and vertical-bar matrices to verify the new behavior. * Add Russian chemistry braille rules and tests Extend Russian braille rules to handle chemical notation: add rules for equilibrium-arrow, reaction operators, repeated charges, charges, and charge-with-subscript mappings (chemical-reaction-operator, chemistry-mhchem-equilibrium-arrow, chemistry-repeated-charge, chemistry-charge, chemistry-charge-with-subscript). Update Rules/Braille/Russian/Russian_Rules.yaml to map arrows, +/-, superscripts/subscripts and reaction operators to appropriate braille sequences. Add tests in tests/braille/Russian/russian.rs (source_chemical_reactions_and_charges) covering reaction arrows, charges, subscripts/superscripts and combined examples. --------- Co-authored-by: Moritz Groß <hi@mgross.dev> Co-authored-by: nsoiffer <soiffer@alum.mit.edu> Co-authored-by: Tuomas Pyorre <82783219+ttpyorre@users.noreply.github.com> Co-authored-by: V3nky <venkatesh6114@gmail.com> Co-authored-by: Hon-Jang Yang <hjy1210@users.noreply.github.com> Co-authored-by: nsoiffer <neil.soiffer@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com>
NSoiffer
added a commit
that referenced
this pull request
Aug 11, 2026
* update acknowledgment for Russian braille * update version number because added Russian braille * UEB has a rule for some pseudo-script chars. The match for that rule was overly broad, so I removed scripted letters and numbers. That rule made its way into other braille codes, so I removed them everywhere. All tests pass. * Added new UEB chars. Many of these are accented letters. I added 'A' (for accented letters) so that the pattern for them looks like: ``` - "Ñ": [t: "CA⠘⠻L⠝"] # 0x00D1 ``` Added a few tests. * Translate German absolute-value ending * Fix German unit plurals * Fix German pluralization for "ruthe" and add regression test * Correct German translations for "ruthe" to "rute" and update regression test * Expand German unit definitions and add regression test for pluralization * fix some symbols * fix german set grammar * typo in example * Russian Braille fixes This commit adds fixes to Russian Braille. Now the test with parentheses is passed. Also there are devision and multiplication signs have been modified according to the Russian braille specs. * Update Russian Braille rules and mappings Fix YAML replace syntax and extend Russian braille rules: add chemical-formula-operator-bond and prefix-geometry-ops rules, broaden function-name matching (include tg/ctg variants) and add separator markers. Update unicode mappings (degree sign, invisible characters, conditional ∪ mapping, parallel/arrow glyphs) and adjust several function/operator braille outputs. Add/expand tests to cover functions, geometry, matrices and chemical formulas to validate the changes. * Add Russian language to docs Add Russian (ru) to the list of supported speech languages and update Russian documentation and translation guidance. - docs/User_guide_for_MathCAT_en.md, docs/index.md: add Russian (ru) to supported languages lists. - docs/ru/User_guide_for_MathCAT_ru.md: include Russian in language options, reorder entries and apply minor wording fixes. - docs/ru/helpers.md: clarify wording, update examples and test instructions to reference ru instead of fr, and improve translation guidance and examples (including test and cargo commands). - docs/ru/index.md: reorder supported languages and polish phrasing. These edits enable and document Russian support and improve clarity for translators and developers working on the Russian localization. * Refactor Russian function braille mapping Replace hardcoded function-name branches in Russian_Rules.yaml with a DefinitionValue lookup that pulls from a new RussianFunctionBraille mapping. Add RussianFunctionBraille entries to definitions.yaml (private-use codepoints U+E100–U+E10E) and map those codepoints to braille strings in unicode.yaml. Add a test covering tan/cot rendering. This centralizes function braille representations and simplifies the rule logic. * Addition of Russian documentation This commit adds Russian documentation for users, developers and translators. * typo in example * Add vector/bar/arc mover rules and tests Introduce three new mover rules in Rules/Braille/Russian/Russian_Rules.yaml: vector-arrow, vector-bar, and geometry-arc. Each rule detects specific accent characters (arrows: → ⟶ ⇀ ⃗; bars: ¯ ‾ _  ̄; arcs: ⌒ ⏜ ︵) and emits the appropriate braille indicators, using a different form when the base has more than one character. Add corresponding tests in tests/braille/Russian/russian.rs to cover single- and multi-character movers and combined expressions. * Add Russian braille math functions and limits Extend Russian braille rules to support additional math functions and large operator limits. Added new rules for large-op-limits, operator/functions (including special handling for div), and div-specific replacements in Rules/Braille/Russian/*. Updated Russian definitions and unicode mappings to include sinh/cosh/tanh/coth, arg/sgn/det/rank/rg, Re/Im, grad/rot/div, gcd/lcm and related braille codes. Updated global Rules/definitions.yaml to recognize new function names. Fixed braille cleanup in src/braille.rs to normalize div encoding. Added unit tests exercising the new function mappings and large operator limits. * Support system left brace in Russian braille Introduce handling for system left-brace matrices in the Russian braille rules: add InSystemLeftBrace variable, a system-left-brace-opener rule and a system-left-brace-table rule to detect brace-enclosed mtable as a system. Update row-start logic to emit appropriate braille tokens when InSystemLeftBrace is set. Add tests exercising curly-brace matrices, piecewise function (brace with conditions), and vertical-bar matrices to verify the new behavior. * Add signed-integer and nested-fraction rules Add handling for nested fractions and signed integers inside script positions and adjust grouping behavior for scripts in Russian braille rules. Changes introduce a nested-fraction rule for mfrac and new signed-integer-number / signed-integer rules for msub/munder and msup/mover, plus a small grouping test (⠐) when scripts contain grouped mrow with '+' or a fraction. Also add a comprehensive regression test (script_grouping_regressions) covering many sup/sub cases to ensure correct braille output. Files updated: Rules/Braille/Russian/Russian_Rules.yaml and tests/braille/Russian/russian.rs. * Enhance Russian Braille support with mathematical symbols and rules (#589) * Refine matrix rule handling by adding support for augmented matrices; update unit tests to include 2x3 and 3x4 augmented matrix scenarios. (#555) * remove logging statement * removed uneeded eprintlin!() * Alternative fix to PR #540. Fixes #528. Includes the tests in the PR. * Add Russian translation * Fix #585 -- SSML was being escaped. I earlier added code to prevent a SSML injection attack by escaping HTML. It was done at the wrong point and escape legal SSML. I have moved the check and conversion down to the leaves. I was very surprised there were no useful tests with SSML. All the main tests set `TTS=None`. I added a test that catches bad escaping. I also added some tests to check for leaf-based SSML attacks and also attribute-based ones. * bump beta number * The range for MATHEMATICAL SANS-SERIF DIGITs had MATHEMATICAL MONOSPACE DIGITs as the match part of translate, so if one of the sans-serif digits were used, you ended up in a loop (no match, to it returned itself). * comment out some debug statements * Add 02DA (˚) to list of circle-like chars -- I thought I had done this already, so it might in some other branch * Add source language option to translation audit tool Allow audit-translations to compare a target language against any source language via --source, defaulting to English for existing workflows. Update CLI output, docs, and tests for dynamic source/target labels, including Swedish/Norwegian comparison coverage. Normalize Rich ANSI output in tests so golden and string assertions remain stable when terminal color is forced. * fix ruff * fix ruff * fix ruff * Core concept names additions and tests -- issue 381 (#592) * initial addition of core concept names * defnitions and tests, with a few failing * minus, plus, volume fixes. Other defined, not appearing in site * fix clippy warnings * use "ruamel.yaml>=0.19.1" in uv.lock and pyproject.toml * handle canonicalize failure in containerized environments (#574) * add 1 week dependency cooldown for uv (#599) * fix rules for digits in german (#596) * update navigation rules for traditional chinese (#588) * copy english version of navigate.yaml from NVDA2026.1 and translate * 更新 definitions.yaml 與 navigate.yaml * update unicode-full.yaml * 區分完全/已完全放大/縮小 * 移至->移到, 表->表格, 數學式->數學, 退出->離開, 不能->無法, 當前->目前。 overview line 47, SimpleSpeak_Rules.yaml line 39, "根號"->""。mroot.rs 對應修改 * 移到上一格 -> 往上一格,移到下一格 -> 往下一格, 佔位符 -> 書籤,設定佔位符 -> 設定書籤,已是最上層 -> 不在別的式子裡面,上一層是 -> 在後面式子裡面,字元模式 開n 次方根 的讀法,基底 -> 基、底 * 向量 -> 射線 * 基 -> 基底,底 -> 基底 * Internally in definitions.yaml, MathCAT uses "nofix", but that's not a MathML airity property. Remove it. * don't say "indexed by", say "sub" * add some terse and verbose forms of speech * fix typo * Added an html file with all the test exprs so that translators have examples to test. * Fix remaining erros after `definitions.yaml` was updated -- needed to add `function:` * fix clippy warning * minor cleanup: remove ASCIIMath-fi reference * Refactor braille.rs to a BrailleCode trait + registry Replace the four scattered string-match dispatch sites (cleanup, get_braille_chars, NeedsToBeGrouped, and highlight knobs) with a single get_braille_code() registry and a BrailleCode trait implemented per code. Extract the duplicated UEB/Vietnam/Finnish/Swedish indicator-replacement closures into one apply_indicator_replacements helper plus a UserTypeforms struct. Behavior is unchanged (all tests/braille pass); adding a new code now means one registry entry + one impl block. Co-authored-by: Cursor <cursoragent@cursor.com> * improved counting for (likey) 8 bit codes when figuring out braille position * make sure this is part of repo * add BrailleDocs to repo (stop ignoring) * updated data, does not include ASCII letters/digits * First version of Russian Braille This commit adds first druft version for Russian Braille. * typo in example * Russian Braille fixes This commit adds fixes to Russian Braille. Now the test with parentheses is passed. Also there are devision and multiplication signs have been modified according to the Russian braille specs. * Braille - Latin and Greek letters fixes This commit adds a layer of Latin and Greek alphabets for Russian mathematical Braille. * In unicode.yaml Latin and Greek letters now go through the internal markers of the alphabetic mode. • In braille.rs russian_cleanup turns these markers into real signs: ◦ Latin lowercase: ⠠ ◦ Latin uppercase: ⠨ ◦ Greek lowercase: ⠰ ◦ Greek uppercase: ⠸ Added tests to russian.rs to x+A+y+B, the Latin letter after the number. * Braille - Roots, powers and scripts This commit adds Roots, powers and scripts according to the Russian math Braille specs. * Update Russian Braille rules and mappings Fix YAML replace syntax and extend Russian braille rules: add chemical-formula-operator-bond and prefix-geometry-ops rules, broaden function-name matching (include tg/ctg variants) and add separator markers. Update unicode mappings (degree sign, invisible characters, conditional ∪ mapping, parallel/arrow glyphs) and adjust several function/operator braille outputs. Add/expand tests to cover functions, geometry, matrices and chemical formulas to validate the changes. * Add Russian language to docs Add Russian (ru) to the list of supported speech languages and update Russian documentation and translation guidance. - docs/User_guide_for_MathCAT_en.md, docs/index.md: add Russian (ru) to supported languages lists. - docs/ru/User_guide_for_MathCAT_ru.md: include Russian in language options, reorder entries and apply minor wording fixes. - docs/ru/helpers.md: clarify wording, update examples and test instructions to reference ru instead of fr, and improve translation guidance and examples (including test and cargo commands). - docs/ru/index.md: reorder supported languages and polish phrasing. These edits enable and document Russian support and improve clarity for translators and developers working on the Russian localization. * Refactor Russian function braille mapping Replace hardcoded function-name branches in Russian_Rules.yaml with a DefinitionValue lookup that pulls from a new RussianFunctionBraille mapping. Add RussianFunctionBraille entries to definitions.yaml (private-use codepoints U+E100–U+E10E) and map those codepoints to braille strings in unicode.yaml. Add a test covering tan/cot rendering. This centralizes function braille representations and simplifies the rule logic. * Refine Russian wording in translators guide Clarify and naturalize Russian phrasing in the translators guide: add explicit "на русском языке" to SimpleSpeak examples; change exponent wording to "в квадрате" with example "икс в квадрате"; make fraction wording more natural ("числитель разделить на знаменатель" and example "метр за секунду"); fix "английском" → "английском языке"; and update Braille tooling phrasing to "просмотрщиком Брайля" and "дисплее Брайля" for consistency. * Add alphabet indicators in russian_cleanup Insert a preprocessing step that injects braille alphabet indicators before running REPLACE_INDICATORS. A new helper add_russian_alphabet_indicators scans the raw braille and emits specific indicators for 'l' (Latin lowercase), 'u' (Latin uppercase), 'g' (Greek lowercase) and 'v' (Greek uppercase), avoiding repeated indicators by tracking the current alphabet mode. The helper also resets the mode on 'C', 'N', and '#'. This keeps the existing indicator replacement and space-collapsing logic intact while preventing redundant alphabet indicators. * Russian braille: add GOST symbols and decimals Add GOST-style number and symbol support for Russian braille: introduce a decimal-comma rule that emits BrailleChars for integer and fractional parts with a decimal indicator, using PUA digit placeholders. Extend unicode mappings with bracket/brace/slash/backslash/pipe characters, Celsius, context-sensitive prime (′/″) handling, PUA digit-to-braille mappings, and a few arrow/connective symbols. Update tests to cover decimal numbers, fractions, set notation, Celsius, and logical arrows, and adjust expected output for geometry primes to reflect the new context-aware prime handling. * Add vector/bar/arc mover rules and tests Introduce three new mover rules in Rules/Braille/Russian/Russian_Rules.yaml: vector-arrow, vector-bar, and geometry-arc. Each rule detects specific accent characters (arrows: → ⟶ ⇀ ⃗; bars: ¯ ‾ _  ̄; arcs: ⌒ ⏜ ︵) and emits the appropriate braille indicators, using a different form when the base has more than one character. Add corresponding tests in tests/braille/Russian/russian.rs to cover single- and multi-character movers and combined expressions. * Add Russian braille math functions and limits Extend Russian braille rules to support additional math functions and large operator limits. Added new rules for large-op-limits, operator/functions (including special handling for div), and div-specific replacements in Rules/Braille/Russian/*. Updated Russian definitions and unicode mappings to include sinh/cosh/tanh/coth, arg/sgn/det/rank/rg, Re/Im, grad/rot/div, gcd/lcm and related braille codes. Updated global Rules/definitions.yaml to recognize new function names. Fixed braille cleanup in src/braille.rs to normalize div encoding. Added unit tests exercising the new function mappings and large operator limits. * Support system left brace in Russian braille Introduce handling for system left-brace matrices in the Russian braille rules: add InSystemLeftBrace variable, a system-left-brace-opener rule and a system-left-brace-table rule to detect brace-enclosed mtable as a system. Update row-start logic to emit appropriate braille tokens when InSystemLeftBrace is set. Add tests exercising curly-brace matrices, piecewise function (brace with conditions), and vertical-bar matrices to verify the new behavior. * Add Russian chemistry braille rules and tests Extend Russian braille rules to handle chemical notation: add rules for equilibrium-arrow, reaction operators, repeated charges, charges, and charge-with-subscript mappings (chemical-reaction-operator, chemistry-mhchem-equilibrium-arrow, chemistry-repeated-charge, chemistry-charge, chemistry-charge-with-subscript). Update Rules/Braille/Russian/Russian_Rules.yaml to map arrows, +/-, superscripts/subscripts and reaction operators to appropriate braille sequences. Add tests in tests/braille/Russian/russian.rs (source_chemical_reactions_and_charges) covering reaction arrows, charges, subscripts/superscripts and combined examples. --------- Co-authored-by: Moritz Groß <hi@mgross.dev> Co-authored-by: nsoiffer <soiffer@alum.mit.edu> Co-authored-by: Tuomas Pyorre <82783219+ttpyorre@users.noreply.github.com> Co-authored-by: V3nky <venkatesh6114@gmail.com> Co-authored-by: Hon-Jang Yang <hjy1210@users.noreply.github.com> Co-authored-by: nsoiffer <neil.soiffer@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com> * Add Russian braille rules for geometry operators Add three new braille encoding rules for geometry operators (∠, △, ∪) in Russian: - canonical-prefix-geometry-op: handles geometry operators in canonical form - geometry-prefix-after-canonical-multiplier: handles operators after canonical multipliers - geometry-prefix-after-multiplier: handles operators after regular multipliers Includes corresponding test cases for angles, triangles, unions, perpendicular, and similar symbols. * Improve Russian braille typeform and mathvariant handling Refactor Russian braille cleanup to properly handle typeform indicators (bold, italic) and mathvariant attributes. Introduces a dedicated typeform indicator function that manages indicator placement according to Russian Braille ГОСТ Р 58511 standard, separating typeform handling from alphabet indicators. Adds support for automatic typeform indicators based on mathvariant attributes, ensuring proper indicator pairing around content blocks. Updates unicode-full.yaml rules to reflect new typeform codes and adds comprehensive tests for various mathvariant combinations. * Propagate mathvariant attribute to children Add mathvariant inheritance from parent elements to children that lack their own mathvariant attribute. This ensures consistent styling throughout nested elements. Includes tests for bold text propagation through mstyle and mrow containers, and verifies that explicit child mathvariants override inherited values. * Fix clippy warnings and improve code style - Remove unnecessary borrows in format! and display calls - Change string slices to arrays in trim_end_matches calls - Replace expect(&format!(...)) with unwrap_or_else(|_| panic!(...)) - Add clippy allow attributes to suppress false positives in tests - Add missing newline at end of build.rs * Remove unnecessary borrows in format macros Remove redundant `&` reference operators from arguments passed to format! macros and similar functions. These values are automatically borrowed by the format machinery, so explicit borrows are unnecessary and reduce readability. * Normalize Unicode math digits in decimal numbers Add normalization of Unicode mathematical alphanumeric symbols (Plane 1 digits) to ASCII digits for number nodes containing decimal points. Skip canonicalize_plane1 processing for already-normalized nodes to prevent double processing. * Remove unnecessary references and .to_string() calls Remove unnecessary `&` borrows in format arguments and replace `.to_string()` with direct display. Simplify byte array literals to byte string literals for readability and idiomatic Rust style. * Remove mathvariant propagation and update tests Drop implicit propagation of the mathvariant attribute from canonicalization (removed propagate_inherited_mathvariant call and helper functions) and update Russian braille tests to set mathvariant explicitly on elements (replace mstyle with mrow and move attributes to mi). Changes in src/canonicalize.rs and tests/braille/Russian/russian.rs. This makes mathvariant handling explicit in tests and avoids mutating child nodes during canonicalization. * Remove math digit normalization for mn nodes Delete the conditional normalization of mathematical digit characters for <mn> text and remove the normalize_math_digits helper from src/canonicalize.rs. Previously the code converted several Unicode math-digit codepoints to ASCII when a decimal point was present. * Adjust test expectations and unignore tests Update expected spoken/braille test outputs across multiple language test files to match updated speech rules (punctuation handling, table phrasing, and unit/roman-numeral rendering). Removed several #[ignore] annotations for the previously skipped "ignore_period_and_space" tests. Minor tidy in pl/definitions.rs to avoid unnecessary format! usage and fix EOF newline. Affected files include tests/Languages/* for en, fi, fr, hu, nb, pl, sv, vi, and zh/tw. * Bump to 0.7.6-beta.8 and update dependencies Update to version 0.7.6-beta.8 with the following changes: - Migrate to no-unsafe variants of sxd-document and sxd-xpath - Add 'no-unsafe' feature flag for unsafe-free builds - Update dependencies: strum, regex, bitflags, env_logger - Add tempfile dev-dependency - Improve build.rs: add rerun-if-changed directives earlier and fix indentation - Exclude BrailleDocs from package * Switch to sxd_document_no_unsafe and NameStr Replace sxd_document/sxd_xpath usages with no-unsafe variants and adapt string types. Key changes in src/braille.rs, src/canonicalize.rs, and src/chemistry.rs: introduce NameStr (feature-gated), use as_str!/as_qname! helpers, convert many attribute_value calls to .as_deref(), update XPath error constructions, and store operator chars as NameStr with PhantomData in OperatorPair. Refactor chemistry tests to helper-based Result flow and use sxd_document_no_unsafe::parser. These edits make the code compatible with the "no-unsafe" pathway and fix lifetime/string mismatches across the codebase. * Use no-unsafe sxd crates; adapt code & tests Replace sxd_document/sxd_xpath with sxd_document_no_unsafe and sxd_xpath_no_unsafe and update imports (including parser). Adjust attribute handling and lifetimes: use as_str!, attribute_value(...).as_deref().unwrap_or_default(), and similar changes to avoid unsafe string lifetimes. Refactor tests to return Result, use ? and panic-catching, and update assertions (e.g. is_empty). Re-enable sample MathML in main, tweak timing_test (disable heavy loops, change loop count). Misc small fixes to satisfy the new APIs and lifetime semantics. * Use no-unsafe sxd libs; refactor TTS & parsing Switch project XML/XPath handling to sxd_document_no_unsafe / sxd_xpath_no_unsafe and adapt code to use as_str!/as_qname! helpers. Update speech and pretty-print logic to use the new context and node APIs, tighten unicode handling, and add debug checks. Refactor TTS APIs so command value accessors return Result and TTS string builders propagate errors. Update tests and prefs helpers (temporary rules dir helper, prefs test flow). Misc: small capacity tweaks and wording fixes in error messages. Files changed: src/prefs.rs, src/pretty_print.rs, src/speech.rs, src/tts.rs. * Improve wording in RU user guide Replace "Трудности в обучении" with "Когнитивные нарушения" in docs/ru/User_guide_for_MathCAT_ru.md to use a more precise and respectful term for users who need shorter spoken output. * Add Russian GOST-58511 typeform braille rules and tests Introduce three Russian GOST-58511 typeform/layout braille rules (small-font, letter-spacing, insertion) to Rules/Braille/Russian/Russian_Rules.yaml with their corresponding braille markers. Expand and reorganize tests in tests/braille/Russian/russian.rs: add coverage for the new typeform indicators, interaction cases, menclose/table/braces, and other edge cases; rename several tests to reflect sectioned/aggregated variants. Also adjust expected braille outputs for a few existing tests (sqrt and geometry matrix cases) to match the new rules/formatting. --------- Co-authored-by: nsoiffer <soiffer@alum.mit.edu> Co-authored-by: mgros <hi@mgross.dev> Co-authored-by: Tuomas Pyorre <82783219+ttpyorre@users.noreply.github.com> Co-authored-by: V3nky <venkatesh6114@gmail.com> Co-authored-by: Hon-Jang Yang <hjy1210@users.noreply.github.com> Co-authored-by: nsoiffer <neil.soiffer@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Kostenkov-2021
added a commit
to Kostenkov-2021/MathCAT
that referenced
this pull request
Aug 13, 2026
* update acknowledgment for Russian braille * update version number because added Russian braille * UEB has a rule for some pseudo-script chars. The match for that rule was overly broad, so I removed scripted letters and numbers. That rule made its way into other braille codes, so I removed them everywhere. All tests pass. * Added new UEB chars. Many of these are accented letters. I added 'A' (for accented letters) so that the pattern for them looks like: ``` - "Ñ": [t: "CA⠘⠻L⠝"] # 0x00D1 ``` Added a few tests. * Translate German absolute-value ending * Fix German unit plurals * Fix German pluralization for "ruthe" and add regression test * Correct German translations for "ruthe" to "rute" and update regression test * Expand German unit definitions and add regression test for pluralization * fix some symbols * fix german set grammar * typo in example * Russian Braille fixes This commit adds fixes to Russian Braille. Now the test with parentheses is passed. Also there are devision and multiplication signs have been modified according to the Russian braille specs. * Update Russian Braille rules and mappings Fix YAML replace syntax and extend Russian braille rules: add chemical-formula-operator-bond and prefix-geometry-ops rules, broaden function-name matching (include tg/ctg variants) and add separator markers. Update unicode mappings (degree sign, invisible characters, conditional ∪ mapping, parallel/arrow glyphs) and adjust several function/operator braille outputs. Add/expand tests to cover functions, geometry, matrices and chemical formulas to validate the changes. * Add Russian language to docs Add Russian (ru) to the list of supported speech languages and update Russian documentation and translation guidance. - docs/User_guide_for_MathCAT_en.md, docs/index.md: add Russian (ru) to supported languages lists. - docs/ru/User_guide_for_MathCAT_ru.md: include Russian in language options, reorder entries and apply minor wording fixes. - docs/ru/helpers.md: clarify wording, update examples and test instructions to reference ru instead of fr, and improve translation guidance and examples (including test and cargo commands). - docs/ru/index.md: reorder supported languages and polish phrasing. These edits enable and document Russian support and improve clarity for translators and developers working on the Russian localization. * Refactor Russian function braille mapping Replace hardcoded function-name branches in Russian_Rules.yaml with a DefinitionValue lookup that pulls from a new RussianFunctionBraille mapping. Add RussianFunctionBraille entries to definitions.yaml (private-use codepoints U+E100–U+E10E) and map those codepoints to braille strings in unicode.yaml. Add a test covering tan/cot rendering. This centralizes function braille representations and simplifies the rule logic. * Addition of Russian documentation This commit adds Russian documentation for users, developers and translators. * typo in example * Add vector/bar/arc mover rules and tests Introduce three new mover rules in Rules/Braille/Russian/Russian_Rules.yaml: vector-arrow, vector-bar, and geometry-arc. Each rule detects specific accent characters (arrows: → ⟶ ⇀ ⃗; bars: ¯ ‾ _  ̄; arcs: ⌒ ⏜ ︵) and emits the appropriate braille indicators, using a different form when the base has more than one character. Add corresponding tests in tests/braille/Russian/russian.rs to cover single- and multi-character movers and combined expressions. * Add Russian braille math functions and limits Extend Russian braille rules to support additional math functions and large operator limits. Added new rules for large-op-limits, operator/functions (including special handling for div), and div-specific replacements in Rules/Braille/Russian/*. Updated Russian definitions and unicode mappings to include sinh/cosh/tanh/coth, arg/sgn/det/rank/rg, Re/Im, grad/rot/div, gcd/lcm and related braille codes. Updated global Rules/definitions.yaml to recognize new function names. Fixed braille cleanup in src/braille.rs to normalize div encoding. Added unit tests exercising the new function mappings and large operator limits. * Support system left brace in Russian braille Introduce handling for system left-brace matrices in the Russian braille rules: add InSystemLeftBrace variable, a system-left-brace-opener rule and a system-left-brace-table rule to detect brace-enclosed mtable as a system. Update row-start logic to emit appropriate braille tokens when InSystemLeftBrace is set. Add tests exercising curly-brace matrices, piecewise function (brace with conditions), and vertical-bar matrices to verify the new behavior. * Add signed-integer and nested-fraction rules Add handling for nested fractions and signed integers inside script positions and adjust grouping behavior for scripts in Russian braille rules. Changes introduce a nested-fraction rule for mfrac and new signed-integer-number / signed-integer rules for msub/munder and msup/mover, plus a small grouping test (⠐) when scripts contain grouped mrow with '+' or a fraction. Also add a comprehensive regression test (script_grouping_regressions) covering many sup/sub cases to ensure correct braille output. Files updated: Rules/Braille/Russian/Russian_Rules.yaml and tests/braille/Russian/russian.rs. * Enhance Russian Braille support with mathematical symbols and rules (daisy#589) * Refine matrix rule handling by adding support for augmented matrices; update unit tests to include 2x3 and 3x4 augmented matrix scenarios. (daisy#555) * remove logging statement * removed uneeded eprintlin!() * Alternative fix to PR daisy#540. Fixes daisy#528. Includes the tests in the PR. * Add Russian translation * Fix daisy#585 -- SSML was being escaped. I earlier added code to prevent a SSML injection attack by escaping HTML. It was done at the wrong point and escape legal SSML. I have moved the check and conversion down to the leaves. I was very surprised there were no useful tests with SSML. All the main tests set `TTS=None`. I added a test that catches bad escaping. I also added some tests to check for leaf-based SSML attacks and also attribute-based ones. * bump beta number * The range for MATHEMATICAL SANS-SERIF DIGITs had MATHEMATICAL MONOSPACE DIGITs as the match part of translate, so if one of the sans-serif digits were used, you ended up in a loop (no match, to it returned itself). * comment out some debug statements * Add 02DA (˚) to list of circle-like chars -- I thought I had done this already, so it might in some other branch * Add source language option to translation audit tool Allow audit-translations to compare a target language against any source language via --source, defaulting to English for existing workflows. Update CLI output, docs, and tests for dynamic source/target labels, including Swedish/Norwegian comparison coverage. Normalize Rich ANSI output in tests so golden and string assertions remain stable when terminal color is forced. * fix ruff * fix ruff * fix ruff * Core concept names additions and tests -- issue 381 (daisy#592) * initial addition of core concept names * defnitions and tests, with a few failing * minus, plus, volume fixes. Other defined, not appearing in site * fix clippy warnings * use "ruamel.yaml>=0.19.1" in uv.lock and pyproject.toml * handle canonicalize failure in containerized environments (daisy#574) * add 1 week dependency cooldown for uv (daisy#599) * fix rules for digits in german (daisy#596) * update navigation rules for traditional chinese (daisy#588) * copy english version of navigate.yaml from NVDA2026.1 and translate * 更新 definitions.yaml 與 navigate.yaml * update unicode-full.yaml * 區分完全/已完全放大/縮小 * 移至->移到, 表->表格, 數學式->數學, 退出->離開, 不能->無法, 當前->目前。 overview line 47, SimpleSpeak_Rules.yaml line 39, "根號"->""。mroot.rs 對應修改 * 移到上一格 -> 往上一格,移到下一格 -> 往下一格, 佔位符 -> 書籤,設定佔位符 -> 設定書籤,已是最上層 -> 不在別的式子裡面,上一層是 -> 在後面式子裡面,字元模式 開n 次方根 的讀法,基底 -> 基、底 * 向量 -> 射線 * 基 -> 基底,底 -> 基底 * Internally in definitions.yaml, MathCAT uses "nofix", but that's not a MathML airity property. Remove it. * don't say "indexed by", say "sub" * add some terse and verbose forms of speech * fix typo * Added an html file with all the test exprs so that translators have examples to test. * Fix remaining erros after `definitions.yaml` was updated -- needed to add `function:` * fix clippy warning * minor cleanup: remove ASCIIMath-fi reference * Refactor braille.rs to a BrailleCode trait + registry Replace the four scattered string-match dispatch sites (cleanup, get_braille_chars, NeedsToBeGrouped, and highlight knobs) with a single get_braille_code() registry and a BrailleCode trait implemented per code. Extract the duplicated UEB/Vietnam/Finnish/Swedish indicator-replacement closures into one apply_indicator_replacements helper plus a UserTypeforms struct. Behavior is unchanged (all tests/braille pass); adding a new code now means one registry entry + one impl block. Co-authored-by: Cursor <cursoragent@cursor.com> * improved counting for (likey) 8 bit codes when figuring out braille position * make sure this is part of repo * add BrailleDocs to repo (stop ignoring) * updated data, does not include ASCII letters/digits * First version of Russian Braille This commit adds first druft version for Russian Braille. * typo in example * Russian Braille fixes This commit adds fixes to Russian Braille. Now the test with parentheses is passed. Also there are devision and multiplication signs have been modified according to the Russian braille specs. * Braille - Latin and Greek letters fixes This commit adds a layer of Latin and Greek alphabets for Russian mathematical Braille. * In unicode.yaml Latin and Greek letters now go through the internal markers of the alphabetic mode. • In braille.rs russian_cleanup turns these markers into real signs: ◦ Latin lowercase: ⠠ ◦ Latin uppercase: ⠨ ◦ Greek lowercase: ⠰ ◦ Greek uppercase: ⠸ Added tests to russian.rs to x+A+y+B, the Latin letter after the number. * Braille - Roots, powers and scripts This commit adds Roots, powers and scripts according to the Russian math Braille specs. * Update Russian Braille rules and mappings Fix YAML replace syntax and extend Russian braille rules: add chemical-formula-operator-bond and prefix-geometry-ops rules, broaden function-name matching (include tg/ctg variants) and add separator markers. Update unicode mappings (degree sign, invisible characters, conditional ∪ mapping, parallel/arrow glyphs) and adjust several function/operator braille outputs. Add/expand tests to cover functions, geometry, matrices and chemical formulas to validate the changes. * Add Russian language to docs Add Russian (ru) to the list of supported speech languages and update Russian documentation and translation guidance. - docs/User_guide_for_MathCAT_en.md, docs/index.md: add Russian (ru) to supported languages lists. - docs/ru/User_guide_for_MathCAT_ru.md: include Russian in language options, reorder entries and apply minor wording fixes. - docs/ru/helpers.md: clarify wording, update examples and test instructions to reference ru instead of fr, and improve translation guidance and examples (including test and cargo commands). - docs/ru/index.md: reorder supported languages and polish phrasing. These edits enable and document Russian support and improve clarity for translators and developers working on the Russian localization. * Refactor Russian function braille mapping Replace hardcoded function-name branches in Russian_Rules.yaml with a DefinitionValue lookup that pulls from a new RussianFunctionBraille mapping. Add RussianFunctionBraille entries to definitions.yaml (private-use codepoints U+E100–U+E10E) and map those codepoints to braille strings in unicode.yaml. Add a test covering tan/cot rendering. This centralizes function braille representations and simplifies the rule logic. * Refine Russian wording in translators guide Clarify and naturalize Russian phrasing in the translators guide: add explicit "на русском языке" to SimpleSpeak examples; change exponent wording to "в квадрате" with example "икс в квадрате"; make fraction wording more natural ("числитель разделить на знаменатель" and example "метр за секунду"); fix "английском" → "английском языке"; and update Braille tooling phrasing to "просмотрщиком Брайля" and "дисплее Брайля" for consistency. * Add alphabet indicators in russian_cleanup Insert a preprocessing step that injects braille alphabet indicators before running REPLACE_INDICATORS. A new helper add_russian_alphabet_indicators scans the raw braille and emits specific indicators for 'l' (Latin lowercase), 'u' (Latin uppercase), 'g' (Greek lowercase) and 'v' (Greek uppercase), avoiding repeated indicators by tracking the current alphabet mode. The helper also resets the mode on 'C', 'N', and '#'. This keeps the existing indicator replacement and space-collapsing logic intact while preventing redundant alphabet indicators. * Russian braille: add GOST symbols and decimals Add GOST-style number and symbol support for Russian braille: introduce a decimal-comma rule that emits BrailleChars for integer and fractional parts with a decimal indicator, using PUA digit placeholders. Extend unicode mappings with bracket/brace/slash/backslash/pipe characters, Celsius, context-sensitive prime (′/″) handling, PUA digit-to-braille mappings, and a few arrow/connective symbols. Update tests to cover decimal numbers, fractions, set notation, Celsius, and logical arrows, and adjust expected output for geometry primes to reflect the new context-aware prime handling. * Add vector/bar/arc mover rules and tests Introduce three new mover rules in Rules/Braille/Russian/Russian_Rules.yaml: vector-arrow, vector-bar, and geometry-arc. Each rule detects specific accent characters (arrows: → ⟶ ⇀ ⃗; bars: ¯ ‾ _  ̄; arcs: ⌒ ⏜ ︵) and emits the appropriate braille indicators, using a different form when the base has more than one character. Add corresponding tests in tests/braille/Russian/russian.rs to cover single- and multi-character movers and combined expressions. * Add Russian braille math functions and limits Extend Russian braille rules to support additional math functions and large operator limits. Added new rules for large-op-limits, operator/functions (including special handling for div), and div-specific replacements in Rules/Braille/Russian/*. Updated Russian definitions and unicode mappings to include sinh/cosh/tanh/coth, arg/sgn/det/rank/rg, Re/Im, grad/rot/div, gcd/lcm and related braille codes. Updated global Rules/definitions.yaml to recognize new function names. Fixed braille cleanup in src/braille.rs to normalize div encoding. Added unit tests exercising the new function mappings and large operator limits. * Support system left brace in Russian braille Introduce handling for system left-brace matrices in the Russian braille rules: add InSystemLeftBrace variable, a system-left-brace-opener rule and a system-left-brace-table rule to detect brace-enclosed mtable as a system. Update row-start logic to emit appropriate braille tokens when InSystemLeftBrace is set. Add tests exercising curly-brace matrices, piecewise function (brace with conditions), and vertical-bar matrices to verify the new behavior. * Add Russian chemistry braille rules and tests Extend Russian braille rules to handle chemical notation: add rules for equilibrium-arrow, reaction operators, repeated charges, charges, and charge-with-subscript mappings (chemical-reaction-operator, chemistry-mhchem-equilibrium-arrow, chemistry-repeated-charge, chemistry-charge, chemistry-charge-with-subscript). Update Rules/Braille/Russian/Russian_Rules.yaml to map arrows, +/-, superscripts/subscripts and reaction operators to appropriate braille sequences. Add tests in tests/braille/Russian/russian.rs (source_chemical_reactions_and_charges) covering reaction arrows, charges, subscripts/superscripts and combined examples. --------- Co-authored-by: Moritz Groß <hi@mgross.dev> Co-authored-by: nsoiffer <soiffer@alum.mit.edu> Co-authored-by: Tuomas Pyorre <82783219+ttpyorre@users.noreply.github.com> Co-authored-by: V3nky <venkatesh6114@gmail.com> Co-authored-by: Hon-Jang Yang <hjy1210@users.noreply.github.com> Co-authored-by: nsoiffer <neil.soiffer@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com> * Add Russian braille rules for geometry operators Add three new braille encoding rules for geometry operators (∠, △, ∪) in Russian: - canonical-prefix-geometry-op: handles geometry operators in canonical form - geometry-prefix-after-canonical-multiplier: handles operators after canonical multipliers - geometry-prefix-after-multiplier: handles operators after regular multipliers Includes corresponding test cases for angles, triangles, unions, perpendicular, and similar symbols. * Improve Russian braille typeform and mathvariant handling Refactor Russian braille cleanup to properly handle typeform indicators (bold, italic) and mathvariant attributes. Introduces a dedicated typeform indicator function that manages indicator placement according to Russian Braille ГОСТ Р 58511 standard, separating typeform handling from alphabet indicators. Adds support for automatic typeform indicators based on mathvariant attributes, ensuring proper indicator pairing around content blocks. Updates unicode-full.yaml rules to reflect new typeform codes and adds comprehensive tests for various mathvariant combinations. * Propagate mathvariant attribute to children Add mathvariant inheritance from parent elements to children that lack their own mathvariant attribute. This ensures consistent styling throughout nested elements. Includes tests for bold text propagation through mstyle and mrow containers, and verifies that explicit child mathvariants override inherited values. * Fix clippy warnings and improve code style - Remove unnecessary borrows in format! and display calls - Change string slices to arrays in trim_end_matches calls - Replace expect(&format!(...)) with unwrap_or_else(|_| panic!(...)) - Add clippy allow attributes to suppress false positives in tests - Add missing newline at end of build.rs * Remove unnecessary borrows in format macros Remove redundant `&` reference operators from arguments passed to format! macros and similar functions. These values are automatically borrowed by the format machinery, so explicit borrows are unnecessary and reduce readability. * Normalize Unicode math digits in decimal numbers Add normalization of Unicode mathematical alphanumeric symbols (Plane 1 digits) to ASCII digits for number nodes containing decimal points. Skip canonicalize_plane1 processing for already-normalized nodes to prevent double processing. * Remove unnecessary references and .to_string() calls Remove unnecessary `&` borrows in format arguments and replace `.to_string()` with direct display. Simplify byte array literals to byte string literals for readability and idiomatic Rust style. * Remove mathvariant propagation and update tests Drop implicit propagation of the mathvariant attribute from canonicalization (removed propagate_inherited_mathvariant call and helper functions) and update Russian braille tests to set mathvariant explicitly on elements (replace mstyle with mrow and move attributes to mi). Changes in src/canonicalize.rs and tests/braille/Russian/russian.rs. This makes mathvariant handling explicit in tests and avoids mutating child nodes during canonicalization. * Remove math digit normalization for mn nodes Delete the conditional normalization of mathematical digit characters for <mn> text and remove the normalize_math_digits helper from src/canonicalize.rs. Previously the code converted several Unicode math-digit codepoints to ASCII when a decimal point was present. * Adjust test expectations and unignore tests Update expected spoken/braille test outputs across multiple language test files to match updated speech rules (punctuation handling, table phrasing, and unit/roman-numeral rendering). Removed several #[ignore] annotations for the previously skipped "ignore_period_and_space" tests. Minor tidy in pl/definitions.rs to avoid unnecessary format! usage and fix EOF newline. Affected files include tests/Languages/* for en, fi, fr, hu, nb, pl, sv, vi, and zh/tw. * Bump to 0.7.6-beta.8 and update dependencies Update to version 0.7.6-beta.8 with the following changes: - Migrate to no-unsafe variants of sxd-document and sxd-xpath - Add 'no-unsafe' feature flag for unsafe-free builds - Update dependencies: strum, regex, bitflags, env_logger - Add tempfile dev-dependency - Improve build.rs: add rerun-if-changed directives earlier and fix indentation - Exclude BrailleDocs from package * Switch to sxd_document_no_unsafe and NameStr Replace sxd_document/sxd_xpath usages with no-unsafe variants and adapt string types. Key changes in src/braille.rs, src/canonicalize.rs, and src/chemistry.rs: introduce NameStr (feature-gated), use as_str!/as_qname! helpers, convert many attribute_value calls to .as_deref(), update XPath error constructions, and store operator chars as NameStr with PhantomData in OperatorPair. Refactor chemistry tests to helper-based Result flow and use sxd_document_no_unsafe::parser. These edits make the code compatible with the "no-unsafe" pathway and fix lifetime/string mismatches across the codebase. * Use no-unsafe sxd crates; adapt code & tests Replace sxd_document/sxd_xpath with sxd_document_no_unsafe and sxd_xpath_no_unsafe and update imports (including parser). Adjust attribute handling and lifetimes: use as_str!, attribute_value(...).as_deref().unwrap_or_default(), and similar changes to avoid unsafe string lifetimes. Refactor tests to return Result, use ? and panic-catching, and update assertions (e.g. is_empty). Re-enable sample MathML in main, tweak timing_test (disable heavy loops, change loop count). Misc small fixes to satisfy the new APIs and lifetime semantics. * Use no-unsafe sxd libs; refactor TTS & parsing Switch project XML/XPath handling to sxd_document_no_unsafe / sxd_xpath_no_unsafe and adapt code to use as_str!/as_qname! helpers. Update speech and pretty-print logic to use the new context and node APIs, tighten unicode handling, and add debug checks. Refactor TTS APIs so command value accessors return Result and TTS string builders propagate errors. Update tests and prefs helpers (temporary rules dir helper, prefs test flow). Misc: small capacity tweaks and wording fixes in error messages. Files changed: src/prefs.rs, src/pretty_print.rs, src/speech.rs, src/tts.rs. * Improve wording in RU user guide Replace "Трудности в обучении" with "Когнитивные нарушения" in docs/ru/User_guide_for_MathCAT_ru.md to use a more precise and respectful term for users who need shorter spoken output. * Add Russian GOST-58511 typeform braille rules and tests Introduce three Russian GOST-58511 typeform/layout braille rules (small-font, letter-spacing, insertion) to Rules/Braille/Russian/Russian_Rules.yaml with their corresponding braille markers. Expand and reorganize tests in tests/braille/Russian/russian.rs: add coverage for the new typeform indicators, interaction cases, menclose/table/braces, and other edge cases; rename several tests to reflect sectioned/aggregated variants. Also adjust expected braille outputs for a few existing tests (sqrt and geometry matrix cases) to match the new rules/formatting. --------- Co-authored-by: nsoiffer <soiffer@alum.mit.edu> Co-authored-by: mgros <hi@mgross.dev> Co-authored-by: Tuomas Pyorre <82783219+ttpyorre@users.noreply.github.com> Co-authored-by: V3nky <venkatesh6114@gmail.com> Co-authored-by: Hon-Jang Yang <hjy1210@users.noreply.github.com> Co-authored-by: nsoiffer <neil.soiffer@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com>
NSoiffer
added a commit
that referenced
this pull request
Aug 15, 2026
* Ru - Improve wording of Russian docs (#661) * update acknowledgment for Russian braille * update version number because added Russian braille * UEB has a rule for some pseudo-script chars. The match for that rule was overly broad, so I removed scripted letters and numbers. That rule made its way into other braille codes, so I removed them everywhere. All tests pass. * Added new UEB chars. Many of these are accented letters. I added 'A' (for accented letters) so that the pattern for them looks like: ``` - "Ñ": [t: "CA⠘⠻L⠝"] # 0x00D1 ``` Added a few tests. * Translate German absolute-value ending * Fix German unit plurals * Fix German pluralization for "ruthe" and add regression test * Correct German translations for "ruthe" to "rute" and update regression test * Expand German unit definitions and add regression test for pluralization * fix some symbols * fix german set grammar * typo in example * Russian Braille fixes This commit adds fixes to Russian Braille. Now the test with parentheses is passed. Also there are devision and multiplication signs have been modified according to the Russian braille specs. * Update Russian Braille rules and mappings Fix YAML replace syntax and extend Russian braille rules: add chemical-formula-operator-bond and prefix-geometry-ops rules, broaden function-name matching (include tg/ctg variants) and add separator markers. Update unicode mappings (degree sign, invisible characters, conditional ∪ mapping, parallel/arrow glyphs) and adjust several function/operator braille outputs. Add/expand tests to cover functions, geometry, matrices and chemical formulas to validate the changes. * Add Russian language to docs Add Russian (ru) to the list of supported speech languages and update Russian documentation and translation guidance. - docs/User_guide_for_MathCAT_en.md, docs/index.md: add Russian (ru) to supported languages lists. - docs/ru/User_guide_for_MathCAT_ru.md: include Russian in language options, reorder entries and apply minor wording fixes. - docs/ru/helpers.md: clarify wording, update examples and test instructions to reference ru instead of fr, and improve translation guidance and examples (including test and cargo commands). - docs/ru/index.md: reorder supported languages and polish phrasing. These edits enable and document Russian support and improve clarity for translators and developers working on the Russian localization. * Refactor Russian function braille mapping Replace hardcoded function-name branches in Russian_Rules.yaml with a DefinitionValue lookup that pulls from a new RussianFunctionBraille mapping. Add RussianFunctionBraille entries to definitions.yaml (private-use codepoints U+E100–U+E10E) and map those codepoints to braille strings in unicode.yaml. Add a test covering tan/cot rendering. This centralizes function braille representations and simplifies the rule logic. * Addition of Russian documentation This commit adds Russian documentation for users, developers and translators. * typo in example * Add vector/bar/arc mover rules and tests Introduce three new mover rules in Rules/Braille/Russian/Russian_Rules.yaml: vector-arrow, vector-bar, and geometry-arc. Each rule detects specific accent characters (arrows: → ⟶ ⇀ ⃗; bars: ¯ ‾ _  ̄; arcs: ⌒ ⏜ ︵) and emits the appropriate braille indicators, using a different form when the base has more than one character. Add corresponding tests in tests/braille/Russian/russian.rs to cover single- and multi-character movers and combined expressions. * Add Russian braille math functions and limits Extend Russian braille rules to support additional math functions and large operator limits. Added new rules for large-op-limits, operator/functions (including special handling for div), and div-specific replacements in Rules/Braille/Russian/*. Updated Russian definitions and unicode mappings to include sinh/cosh/tanh/coth, arg/sgn/det/rank/rg, Re/Im, grad/rot/div, gcd/lcm and related braille codes. Updated global Rules/definitions.yaml to recognize new function names. Fixed braille cleanup in src/braille.rs to normalize div encoding. Added unit tests exercising the new function mappings and large operator limits. * Support system left brace in Russian braille Introduce handling for system left-brace matrices in the Russian braille rules: add InSystemLeftBrace variable, a system-left-brace-opener rule and a system-left-brace-table rule to detect brace-enclosed mtable as a system. Update row-start logic to emit appropriate braille tokens when InSystemLeftBrace is set. Add tests exercising curly-brace matrices, piecewise function (brace with conditions), and vertical-bar matrices to verify the new behavior. * Add signed-integer and nested-fraction rules Add handling for nested fractions and signed integers inside script positions and adjust grouping behavior for scripts in Russian braille rules. Changes introduce a nested-fraction rule for mfrac and new signed-integer-number / signed-integer rules for msub/munder and msup/mover, plus a small grouping test (⠐) when scripts contain grouped mrow with '+' or a fraction. Also add a comprehensive regression test (script_grouping_regressions) covering many sup/sub cases to ensure correct braille output. Files updated: Rules/Braille/Russian/Russian_Rules.yaml and tests/braille/Russian/russian.rs. * Enhance Russian Braille support with mathematical symbols and rules (#589) * Refine matrix rule handling by adding support for augmented matrices; update unit tests to include 2x3 and 3x4 augmented matrix scenarios. (#555) * remove logging statement * removed uneeded eprintlin!() * Alternative fix to PR #540. Fixes #528. Includes the tests in the PR. * Add Russian translation * Fix #585 -- SSML was being escaped. I earlier added code to prevent a SSML injection attack by escaping HTML. It was done at the wrong point and escape legal SSML. I have moved the check and conversion down to the leaves. I was very surprised there were no useful tests with SSML. All the main tests set `TTS=None`. I added a test that catches bad escaping. I also added some tests to check for leaf-based SSML attacks and also attribute-based ones. * bump beta number * The range for MATHEMATICAL SANS-SERIF DIGITs had MATHEMATICAL MONOSPACE DIGITs as the match part of translate, so if one of the sans-serif digits were used, you ended up in a loop (no match, to it returned itself). * comment out some debug statements * Add 02DA (˚) to list of circle-like chars -- I thought I had done this already, so it might in some other branch * Add source language option to translation audit tool Allow audit-translations to compare a target language against any source language via --source, defaulting to English for existing workflows. Update CLI output, docs, and tests for dynamic source/target labels, including Swedish/Norwegian comparison coverage. Normalize Rich ANSI output in tests so golden and string assertions remain stable when terminal color is forced. * fix ruff * fix ruff * fix ruff * Core concept names additions and tests -- issue 381 (#592) * initial addition of core concept names * defnitions and tests, with a few failing * minus, plus, volume fixes. Other defined, not appearing in site * fix clippy warnings * use "ruamel.yaml>=0.19.1" in uv.lock and pyproject.toml * handle canonicalize failure in containerized environments (#574) * add 1 week dependency cooldown for uv (#599) * fix rules for digits in german (#596) * update navigation rules for traditional chinese (#588) * copy english version of navigate.yaml from NVDA2026.1 and translate * 更新 definitions.yaml 與 navigate.yaml * update unicode-full.yaml * 區分完全/已完全放大/縮小 * 移至->移到, 表->表格, 數學式->數學, 退出->離開, 不能->無法, 當前->目前。 overview line 47, SimpleSpeak_Rules.yaml line 39, "根號"->""。mroot.rs 對應修改 * 移到上一格 -> 往上一格,移到下一格 -> 往下一格, 佔位符 -> 書籤,設定佔位符 -> 設定書籤,已是最上層 -> 不在別的式子裡面,上一層是 -> 在後面式子裡面,字元模式 開n 次方根 的讀法,基底 -> 基、底 * 向量 -> 射線 * 基 -> 基底,底 -> 基底 * Internally in definitions.yaml, MathCAT uses "nofix", but that's not a MathML airity property. Remove it. * don't say "indexed by", say "sub" * add some terse and verbose forms of speech * fix typo * Added an html file with all the test exprs so that translators have examples to test. * Fix remaining erros after `definitions.yaml` was updated -- needed to add `function:` * fix clippy warning * minor cleanup: remove ASCIIMath-fi reference * Refactor braille.rs to a BrailleCode trait + registry Replace the four scattered string-match dispatch sites (cleanup, get_braille_chars, NeedsToBeGrouped, and highlight knobs) with a single get_braille_code() registry and a BrailleCode trait implemented per code. Extract the duplicated UEB/Vietnam/Finnish/Swedish indicator-replacement closures into one apply_indicator_replacements helper plus a UserTypeforms struct. Behavior is unchanged (all tests/braille pass); adding a new code now means one registry entry + one impl block. Co-authored-by: Cursor <cursoragent@cursor.com> * improved counting for (likey) 8 bit codes when figuring out braille position * make sure this is part of repo * add BrailleDocs to repo (stop ignoring) * updated data, does not include ASCII letters/digits * First version of Russian Braille This commit adds first druft version for Russian Braille. * typo in example * Russian Braille fixes This commit adds fixes to Russian Braille. Now the test with parentheses is passed. Also there are devision and multiplication signs have been modified according to the Russian braille specs. * Braille - Latin and Greek letters fixes This commit adds a layer of Latin and Greek alphabets for Russian mathematical Braille. * In unicode.yaml Latin and Greek letters now go through the internal markers of the alphabetic mode. • In braille.rs russian_cleanup turns these markers into real signs: ◦ Latin lowercase: ⠠ ◦ Latin uppercase: ⠨ ◦ Greek lowercase: ⠰ ◦ Greek uppercase: ⠸ Added tests to russian.rs to x+A+y+B, the Latin letter after the number. * Braille - Roots, powers and scripts This commit adds Roots, powers and scripts according to the Russian math Braille specs. * Update Russian Braille rules and mappings Fix YAML replace syntax and extend Russian braille rules: add chemical-formula-operator-bond and prefix-geometry-ops rules, broaden function-name matching (include tg/ctg variants) and add separator markers. Update unicode mappings (degree sign, invisible characters, conditional ∪ mapping, parallel/arrow glyphs) and adjust several function/operator braille outputs. Add/expand tests to cover functions, geometry, matrices and chemical formulas to validate the changes. * Add Russian language to docs Add Russian (ru) to the list of supported speech languages and update Russian documentation and translation guidance. - docs/User_guide_for_MathCAT_en.md, docs/index.md: add Russian (ru) to supported languages lists. - docs/ru/User_guide_for_MathCAT_ru.md: include Russian in language options, reorder entries and apply minor wording fixes. - docs/ru/helpers.md: clarify wording, update examples and test instructions to reference ru instead of fr, and improve translation guidance and examples (including test and cargo commands). - docs/ru/index.md: reorder supported languages and polish phrasing. These edits enable and document Russian support and improve clarity for translators and developers working on the Russian localization. * Refactor Russian function braille mapping Replace hardcoded function-name branches in Russian_Rules.yaml with a DefinitionValue lookup that pulls from a new RussianFunctionBraille mapping. Add RussianFunctionBraille entries to definitions.yaml (private-use codepoints U+E100–U+E10E) and map those codepoints to braille strings in unicode.yaml. Add a test covering tan/cot rendering. This centralizes function braille representations and simplifies the rule logic. * Refine Russian wording in translators guide Clarify and naturalize Russian phrasing in the translators guide: add explicit "на русском языке" to SimpleSpeak examples; change exponent wording to "в квадрате" with example "икс в квадрате"; make fraction wording more natural ("числитель разделить на знаменатель" and example "метр за секунду"); fix "английском" → "английском языке"; and update Braille tooling phrasing to "просмотрщиком Брайля" and "дисплее Брайля" for consistency. * Add alphabet indicators in russian_cleanup Insert a preprocessing step that injects braille alphabet indicators before running REPLACE_INDICATORS. A new helper add_russian_alphabet_indicators scans the raw braille and emits specific indicators for 'l' (Latin lowercase), 'u' (Latin uppercase), 'g' (Greek lowercase) and 'v' (Greek uppercase), avoiding repeated indicators by tracking the current alphabet mode. The helper also resets the mode on 'C', 'N', and '#'. This keeps the existing indicator replacement and space-collapsing logic intact while preventing redundant alphabet indicators. * Russian braille: add GOST symbols and decimals Add GOST-style number and symbol support for Russian braille: introduce a decimal-comma rule that emits BrailleChars for integer and fractional parts with a decimal indicator, using PUA digit placeholders. Extend unicode mappings with bracket/brace/slash/backslash/pipe characters, Celsius, context-sensitive prime (′/″) handling, PUA digit-to-braille mappings, and a few arrow/connective symbols. Update tests to cover decimal numbers, fractions, set notation, Celsius, and logical arrows, and adjust expected output for geometry primes to reflect the new context-aware prime handling. * Add vector/bar/arc mover rules and tests Introduce three new mover rules in Rules/Braille/Russian/Russian_Rules.yaml: vector-arrow, vector-bar, and geometry-arc. Each rule detects specific accent characters (arrows: → ⟶ ⇀ ⃗; bars: ¯ ‾ _  ̄; arcs: ⌒ ⏜ ︵) and emits the appropriate braille indicators, using a different form when the base has more than one character. Add corresponding tests in tests/braille/Russian/russian.rs to cover single- and multi-character movers and combined expressions. * Add Russian braille math functions and limits Extend Russian braille rules to support additional math functions and large operator limits. Added new rules for large-op-limits, operator/functions (including special handling for div), and div-specific replacements in Rules/Braille/Russian/*. Updated Russian definitions and unicode mappings to include sinh/cosh/tanh/coth, arg/sgn/det/rank/rg, Re/Im, grad/rot/div, gcd/lcm and related braille codes. Updated global Rules/definitions.yaml to recognize new function names. Fixed braille cleanup in src/braille.rs to normalize div encoding. Added unit tests exercising the new function mappings and large operator limits. * Support system left brace in Russian braille Introduce handling for system left-brace matrices in the Russian braille rules: add InSystemLeftBrace variable, a system-left-brace-opener rule and a system-left-brace-table rule to detect brace-enclosed mtable as a system. Update row-start logic to emit appropriate braille tokens when InSystemLeftBrace is set. Add tests exercising curly-brace matrices, piecewise function (brace with conditions), and vertical-bar matrices to verify the new behavior. * Add Russian chemistry braille rules and tests Extend Russian braille rules to handle chemical notation: add rules for equilibrium-arrow, reaction operators, repeated charges, charges, and charge-with-subscript mappings (chemical-reaction-operator, chemistry-mhchem-equilibrium-arrow, chemistry-repeated-charge, chemistry-charge, chemistry-charge-with-subscript). Update Rules/Braille/Russian/Russian_Rules.yaml to map arrows, +/-, superscripts/subscripts and reaction operators to appropriate braille sequences. Add tests in tests/braille/Russian/russian.rs (source_chemical_reactions_and_charges) covering reaction arrows, charges, subscripts/superscripts and combined examples. --------- Co-authored-by: Moritz Groß <hi@mgross.dev> Co-authored-by: nsoiffer <soiffer@alum.mit.edu> Co-authored-by: Tuomas Pyorre <82783219+ttpyorre@users.noreply.github.com> Co-authored-by: V3nky <venkatesh6114@gmail.com> Co-authored-by: Hon-Jang Yang <hjy1210@users.noreply.github.com> Co-authored-by: nsoiffer <neil.soiffer@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com> * Add Russian braille rules for geometry operators Add three new braille encoding rules for geometry operators (∠, △, ∪) in Russian: - canonical-prefix-geometry-op: handles geometry operators in canonical form - geometry-prefix-after-canonical-multiplier: handles operators after canonical multipliers - geometry-prefix-after-multiplier: handles operators after regular multipliers Includes corresponding test cases for angles, triangles, unions, perpendicular, and similar symbols. * Improve Russian braille typeform and mathvariant handling Refactor Russian braille cleanup to properly handle typeform indicators (bold, italic) and mathvariant attributes. Introduces a dedicated typeform indicator function that manages indicator placement according to Russian Braille ГОСТ Р 58511 standard, separating typeform handling from alphabet indicators. Adds support for automatic typeform indicators based on mathvariant attributes, ensuring proper indicator pairing around content blocks. Updates unicode-full.yaml rules to reflect new typeform codes and adds comprehensive tests for various mathvariant combinations. * Propagate mathvariant attribute to children Add mathvariant inheritance from parent elements to children that lack their own mathvariant attribute. This ensures consistent styling throughout nested elements. Includes tests for bold text propagation through mstyle and mrow containers, and verifies that explicit child mathvariants override inherited values. * Fix clippy warnings and improve code style - Remove unnecessary borrows in format! and display calls - Change string slices to arrays in trim_end_matches calls - Replace expect(&format!(...)) with unwrap_or_else(|_| panic!(...)) - Add clippy allow attributes to suppress false positives in tests - Add missing newline at end of build.rs * Remove unnecessary borrows in format macros Remove redundant `&` reference operators from arguments passed to format! macros and similar functions. These values are automatically borrowed by the format machinery, so explicit borrows are unnecessary and reduce readability. * Normalize Unicode math digits in decimal numbers Add normalization of Unicode mathematical alphanumeric symbols (Plane 1 digits) to ASCII digits for number nodes containing decimal points. Skip canonicalize_plane1 processing for already-normalized nodes to prevent double processing. * Remove unnecessary references and .to_string() calls Remove unnecessary `&` borrows in format arguments and replace `.to_string()` with direct display. Simplify byte array literals to byte string literals for readability and idiomatic Rust style. * Remove mathvariant propagation and update tests Drop implicit propagation of the mathvariant attribute from canonicalization (removed propagate_inherited_mathvariant call and helper functions) and update Russian braille tests to set mathvariant explicitly on elements (replace mstyle with mrow and move attributes to mi). Changes in src/canonicalize.rs and tests/braille/Russian/russian.rs. This makes mathvariant handling explicit in tests and avoids mutating child nodes during canonicalization. * Remove math digit normalization for mn nodes Delete the conditional normalization of mathematical digit characters for <mn> text and remove the normalize_math_digits helper from src/canonicalize.rs. Previously the code converted several Unicode math-digit codepoints to ASCII when a decimal point was present. * Adjust test expectations and unignore tests Update expected spoken/braille test outputs across multiple language test files to match updated speech rules (punctuation handling, table phrasing, and unit/roman-numeral rendering). Removed several #[ignore] annotations for the previously skipped "ignore_period_and_space" tests. Minor tidy in pl/definitions.rs to avoid unnecessary format! usage and fix EOF newline. Affected files include tests/Languages/* for en, fi, fr, hu, nb, pl, sv, vi, and zh/tw. * Bump to 0.7.6-beta.8 and update dependencies Update to version 0.7.6-beta.8 with the following changes: - Migrate to no-unsafe variants of sxd-document and sxd-xpath - Add 'no-unsafe' feature flag for unsafe-free builds - Update dependencies: strum, regex, bitflags, env_logger - Add tempfile dev-dependency - Improve build.rs: add rerun-if-changed directives earlier and fix indentation - Exclude BrailleDocs from package * Switch to sxd_document_no_unsafe and NameStr Replace sxd_document/sxd_xpath usages with no-unsafe variants and adapt string types. Key changes in src/braille.rs, src/canonicalize.rs, and src/chemistry.rs: introduce NameStr (feature-gated), use as_str!/as_qname! helpers, convert many attribute_value calls to .as_deref(), update XPath error constructions, and store operator chars as NameStr with PhantomData in OperatorPair. Refactor chemistry tests to helper-based Result flow and use sxd_document_no_unsafe::parser. These edits make the code compatible with the "no-unsafe" pathway and fix lifetime/string mismatches across the codebase. * Use no-unsafe sxd crates; adapt code & tests Replace sxd_document/sxd_xpath with sxd_document_no_unsafe and sxd_xpath_no_unsafe and update imports (including parser). Adjust attribute handling and lifetimes: use as_str!, attribute_value(...).as_deref().unwrap_or_default(), and similar changes to avoid unsafe string lifetimes. Refactor tests to return Result, use ? and panic-catching, and update assertions (e.g. is_empty). Re-enable sample MathML in main, tweak timing_test (disable heavy loops, change loop count). Misc small fixes to satisfy the new APIs and lifetime semantics. * Use no-unsafe sxd libs; refactor TTS & parsing Switch project XML/XPath handling to sxd_document_no_unsafe / sxd_xpath_no_unsafe and adapt code to use as_str!/as_qname! helpers. Update speech and pretty-print logic to use the new context and node APIs, tighten unicode handling, and add debug checks. Refactor TTS APIs so command value accessors return Result and TTS string builders propagate errors. Update tests and prefs helpers (temporary rules dir helper, prefs test flow). Misc: small capacity tweaks and wording fixes in error messages. Files changed: src/prefs.rs, src/pretty_print.rs, src/speech.rs, src/tts.rs. * Improve wording in RU user guide Replace "Трудности в обучении" with "Когнитивные нарушения" in docs/ru/User_guide_for_MathCAT_ru.md to use a more precise and respectful term for users who need shorter spoken output. * Add Russian GOST-58511 typeform braille rules and tests Introduce three Russian GOST-58511 typeform/layout braille rules (small-font, letter-spacing, insertion) to Rules/Braille/Russian/Russian_Rules.yaml with their corresponding braille markers. Expand and reorganize tests in tests/braille/Russian/russian.rs: add coverage for the new typeform indicators, interaction cases, menclose/table/braces, and other edge cases; rename several tests to reflect sectioned/aggregated variants. Also adjust expected braille outputs for a few existing tests (sqrt and geometry matrix cases) to match the new rules/formatting. --------- Co-authored-by: nsoiffer <soiffer@alum.mit.edu> Co-authored-by: mgros <hi@mgross.dev> Co-authored-by: Tuomas Pyorre <82783219+ttpyorre@users.noreply.github.com> Co-authored-by: V3nky <venkatesh6114@gmail.com> Co-authored-by: Hon-Jang Yang <hjy1210@users.noreply.github.com> Co-authored-by: nsoiffer <neil.soiffer@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com> * force bring over the files from main -- merging didn't do the right thing * Ru - handle lone log/ln; suppress nav announcements (#681) * ru: handle lone log/ln; suppress nav announcements Add handling for lone mi elements 'log' and 'ln' in ClearSpeak (supports Verbosity and ClearSpeak_Log LnAsNaturalLog option). Add a navigation rule to avoid announcing "in/out of" for prefix or silent intents that have no NavigationParts. Include unit tests: new ClearSpeak tests for individual log/ln, new navigate tests for suppressed base announcements, and register the navigate test module. * Russian braille: bracket/arrow mappings & tests Add contextual bracket-recognition rules (square and angle) to Rules/Braille/Russian/Russian_Rules.yaml and add Unicode braille mappings for ≶, ≷, ⟨, ⟩, ↑, ↓ in Rules/Braille/Russian/unicode.yaml. Extend tests in tests/braille/Russian/russian.rs to cover Russian Braille GOST 2019 order relations, large vertical arrows, and contextual bracket recognition for square and angle brackets, validating the expected braille output. --------- Co-authored-by: Danil <81031453+Kostenkov-2021@users.noreply.github.com> Co-authored-by: mgros <hi@mgross.dev> Co-authored-by: Tuomas Pyorre <82783219+ttpyorre@users.noreply.github.com> Co-authored-by: V3nky <venkatesh6114@gmail.com> Co-authored-by: Hon-Jang Yang <hjy1210@users.noreply.github.com> Co-authored-by: nsoiffer <neil.soiffer@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com>
NSoiffer
added a commit
that referenced
this pull request
Sep 24, 2026
* Initial commit for French braille.
24 test passes, 3 test failures
* Added a table of atomic numbers for the elements and added a test for atomic numbers in prescripts to bump up their liklihood number. This allows single character elements with pre subscripts that match their atomic number to be considered chemistry.
* renamed test
* Update braille.rs to compile after merging.
Add French to the braille testing file.
New French braille tests.
* Updated to main. Needed to update the format of the tests to match the others.
* It appears some logic was missing parens -- not sure why this always worked...
* Lots more cleanup of tests, additions of rules.
Now at 78 pass/15 fail.
* fix clippy warning
* More fixes for French braille. Now at 89 correct, 8 fail, with most of the failures being open questions.
* pass through braille chars as is
* UEB has a rule for some pseudo-script chars. The match for that rule was overly broad, so I removed scripted letters and numbers. That rule made its way into other braille codes, so I removed them everywhere. All tests pass.
* Added new UEB chars. Many of these are accented letters. I added 'A' (for accented letters) so that the pattern for them looks like:
```
- "Ñ": [t: "CA⠘⠻L⠝"] # 0x00D1
```
Added a few tests.
* change small spaces from 'W' to ''
* add 'H' for Hebrew alphabet indicator
* promote munder/mover/munderover base attrs to element -- prevents error!() message. May want to change the promoted name...
* all primes on chem symbols such as R' -- used to be a reject, now neutral
* Fix leftover value for G1 indicator -- unlike UEB, French braille numbers don't conflict with letters.
Add code to handle `;` special case if there are "blocks" in the expr
* Lots of fixes and addition of tests.
Now at 185 passed; 4 failed
* Add "(eau)" as a state (for French)
Added several more chem arrows.
* add more arrows. French at the moment doesn't seem to distinguish between different arrows that go in the same direction. That seems wrong, but the spec is silent on the alternatives
* removed some intent attrs that were not needed
* uncomment a determinant test after fixing the braille
* Add rules for multiple lines in a script position done via an mtable or a more restricted version for nested munder/mover. They add a "," between lines.
This was done for limit_x_tends_1_14_2_01_corrected and limit_x_tends_1_14_2_02_corrected
* a linebreaks to MathML to make it easier to read
* add more arrow chars -- I thought I did this in a previous commit, but apparently not.
* Add MathJax demo link to developer docs for rendering inspection
* .
* Merge changes (mostly unicode) from hu branch (#688)
* Add few tweaks into the Rules/Languages/hu/definitions.yaml file, Added missing definitions.rs test file the test/Languages/hu directory, and added SimpleSpeak test directory the mroot and menclose tests (#646)
* Do more localization in Rules/Languages/hu/definitions.yaml
Signed-off-by: Attila Hammer <hammera@pickup.hu>
* Add in Simplespeak tests the definition, mroot and menclose tests
Signed-off-by: Attila Hammer <hammera@pickup.hu>
* fix some werbs in intervals into rules/Languages/hu/ClearSpeak_rules.yaml and SimpleSpeak_rules.yaml
Signed-off-by: Attila Hammer <hammera@pickup.hu>
* Fix tests after interval Clearspeak and SimpleSpeak verb change
Signed-off-by: Attila Hammer <hammera@pickup.hu>
---------
Signed-off-by: Attila Hammer <hammera@pickup.hu>
* Apply Hungarian unicode fixes from PR #673
---------
Signed-off-by: Attila Hammer <hammera@pickup.hu>
Co-authored-by: hammera <hammera@pickup.hu>
* Ru -- merge speech changes into main (#689)
* Ru - Improve wording of Russian docs (#661)
* update acknowledgment for Russian braille
* update version number because added Russian braille
* UEB has a rule for some pseudo-script chars. The match for that rule was overly broad, so I removed scripted letters and numbers. That rule made its way into other braille codes, so I removed them everywhere. All tests pass.
* Added new UEB chars. Many of these are accented letters. I added 'A' (for accented letters) so that the pattern for them looks like:
```
- "Ñ": [t: "CA⠘⠻L⠝"] # 0x00D1
```
Added a few tests.
* Translate German absolute-value ending
* Fix German unit plurals
* Fix German pluralization for "ruthe" and add regression test
* Correct German translations for "ruthe" to "rute" and update regression test
* Expand German unit definitions and add regression test for pluralization
* fix some symbols
* fix german set grammar
* typo in example
* Russian Braille fixes
This commit adds fixes to Russian Braille. Now the test with parentheses is passed. Also there are devision and multiplication signs have been modified according to the Russian braille specs.
* Update Russian Braille rules and mappings
Fix YAML replace syntax and extend Russian braille rules: add chemical-formula-operator-bond and prefix-geometry-ops rules, broaden function-name matching (include tg/ctg variants) and add separator markers. Update unicode mappings (degree sign, invisible characters, conditional ∪ mapping, parallel/arrow glyphs) and adjust several function/operator braille outputs. Add/expand tests to cover functions, geometry, matrices and chemical formulas to validate the changes.
* Add Russian language to docs
Add Russian (ru) to the list of supported speech languages and update Russian documentation and translation guidance.
- docs/User_guide_for_MathCAT_en.md, docs/index.md: add Russian (ru) to supported languages lists.
- docs/ru/User_guide_for_MathCAT_ru.md: include Russian in language options, reorder entries and apply minor wording fixes.
- docs/ru/helpers.md: clarify wording, update examples and test instructions to reference ru instead of fr, and improve translation guidance and examples (including test and cargo commands).
- docs/ru/index.md: reorder supported languages and polish phrasing.
These edits enable and document Russian support and improve clarity for translators and developers working on the Russian localization.
* Refactor Russian function braille mapping
Replace hardcoded function-name branches in Russian_Rules.yaml with a DefinitionValue lookup that pulls from a new RussianFunctionBraille mapping. Add RussianFunctionBraille entries to definitions.yaml (private-use codepoints U+E100–U+E10E) and map those codepoints to braille strings in unicode.yaml. Add a test covering tan/cot rendering. This centralizes function braille representations and simplifies the rule logic.
* Addition of Russian documentation
This commit adds Russian documentation for users, developers and translators.
* typo in example
* Add vector/bar/arc mover rules and tests
Introduce three new mover rules in Rules/Braille/Russian/Russian_Rules.yaml: vector-arrow, vector-bar, and geometry-arc. Each rule detects specific accent characters (arrows: → ⟶ ⇀ ⃗; bars: ¯ ‾ _  ̄; arcs: ⌒ ⏜ ︵) and emits the appropriate braille indicators, using a different form when the base has more than one character. Add corresponding tests in tests/braille/Russian/russian.rs to cover single- and multi-character movers and combined expressions.
* Add Russian braille math functions and limits
Extend Russian braille rules to support additional math functions and large operator limits. Added new rules for large-op-limits, operator/functions (including special handling for div), and div-specific replacements in Rules/Braille/Russian/*. Updated Russian definitions and unicode mappings to include sinh/cosh/tanh/coth, arg/sgn/det/rank/rg, Re/Im, grad/rot/div, gcd/lcm and related braille codes. Updated global Rules/definitions.yaml to recognize new function names. Fixed braille cleanup in src/braille.rs to normalize div encoding. Added unit tests exercising the new function mappings and large operator limits.
* Support system left brace in Russian braille
Introduce handling for system left-brace matrices in the Russian braille rules: add InSystemLeftBrace variable, a system-left-brace-opener rule and a system-left-brace-table rule to detect brace-enclosed mtable as a system. Update row-start logic to emit appropriate braille tokens when InSystemLeftBrace is set. Add tests exercising curly-brace matrices, piecewise function (brace with conditions), and vertical-bar matrices to verify the new behavior.
* Add signed-integer and nested-fraction rules
Add handling for nested fractions and signed integers inside script positions and adjust grouping behavior for scripts in Russian braille rules. Changes introduce a nested-fraction rule for mfrac and new signed-integer-number / signed-integer rules for msub/munder and msup/mover, plus a small grouping test (⠐) when scripts contain grouped mrow with '+' or a fraction. Also add a comprehensive regression test (script_grouping_regressions) covering many sup/sub cases to ensure correct braille output. Files updated: Rules/Braille/Russian/Russian_Rules.yaml and tests/braille/Russian/russian.rs.
* Enhance Russian Braille support with mathematical symbols and rules (#589)
* Refine matrix rule handling by adding support for augmented matrices; update unit tests to include 2x3 and 3x4 augmented matrix scenarios. (#555)
* remove logging statement
* removed uneeded eprintlin!()
* Alternative fix to PR #540.
Fixes #528.
Includes the tests in the PR.
* Add Russian translation
* Fix #585 -- SSML was being escaped.
I earlier added code to prevent a SSML injection attack by escaping HTML. It was done at the wrong point and escape legal SSML. I have moved the check and conversion down to the leaves.
I was very surprised there were no useful tests with SSML. All the main tests set `TTS=None`. I added a test that catches bad escaping. I also added some tests to check for leaf-based SSML attacks and also attribute-based ones.
* bump beta number
* The range for MATHEMATICAL SANS-SERIF DIGITs had MATHEMATICAL MONOSPACE DIGITs as the match part of translate, so if one of the sans-serif digits were used, you ended up in a loop (no match, to it returned itself).
* comment out some debug statements
* Add 02DA (˚) to list of circle-like chars -- I thought I had done this already, so it might in some other branch
* Add source language option to translation audit tool
Allow audit-translations to compare a target language against any source
language via --source, defaulting to English for existing workflows. Update
CLI output, docs, and tests for dynamic source/target labels, including
Swedish/Norwegian comparison coverage.
Normalize Rich ANSI output in tests so golden and string assertions remain
stable when terminal color is forced.
* fix ruff
* fix ruff
* fix ruff
* Core concept names additions and tests -- issue 381 (#592)
* initial addition of core concept names
* defnitions and tests, with a few failing
* minus, plus, volume fixes. Other defined, not appearing in site
* fix clippy warnings
* use "ruamel.yaml>=0.19.1" in uv.lock and pyproject.toml
* handle canonicalize failure in containerized environments (#574)
* add 1 week dependency cooldown for uv (#599)
* fix rules for digits in german (#596)
* update navigation rules for traditional chinese (#588)
* copy english version of navigate.yaml from NVDA2026.1 and translate
* 更新 definitions.yaml 與 navigate.yaml
* update unicode-full.yaml
* 區分完全/已完全放大/縮小
* 移至->移到, 表->表格, 數學式->數學, 退出->離開, 不能->無法, 當前->目前。
overview line 47, SimpleSpeak_Rules.yaml line 39, "根號"->""。mroot.rs 對應修改
* 移到上一格 -> 往上一格,移到下一格 -> 往下一格, 佔位符 -> 書籤,設定佔位符 -> 設定書籤,已是最上層 -> 不在別的式子裡面,上一層是 -> 在後面式子裡面,字元模式 開n 次方根 的讀法,基底 -> 基、底
* 向量 -> 射線
* 基 -> 基底,底 -> 基底
* Internally in definitions.yaml, MathCAT uses "nofix", but that's not
a MathML airity property. Remove it.
* don't say "indexed by", say "sub"
* add some terse and verbose forms of speech
* fix typo
* Added an html file with all the test exprs so that translators have examples to test.
* Fix remaining erros after `definitions.yaml` was updated -- needed to add `function:`
* fix clippy warning
* minor cleanup: remove ASCIIMath-fi reference
* Refactor braille.rs to a BrailleCode trait + registry
Replace the four scattered string-match dispatch sites (cleanup,
get_braille_chars, NeedsToBeGrouped, and highlight knobs) with a single
get_braille_code() registry and a BrailleCode trait implemented per code.
Extract the duplicated UEB/Vietnam/Finnish/Swedish indicator-replacement
closures into one apply_indicator_replacements helper plus a UserTypeforms
struct. Behavior is unchanged (all tests/braille pass); adding a new code
now means one registry entry + one impl block.
Co-authored-by: Cursor <cursoragent@cursor.com>
* improved counting for (likey) 8 bit codes when figuring out braille position
* make sure this is part of repo
* add BrailleDocs to repo (stop ignoring)
* updated data, does not include ASCII letters/digits
* First version of Russian Braille
This commit adds first druft version for Russian Braille.
* typo in example
* Russian Braille fixes
This commit adds fixes to Russian Braille. Now the test with parentheses is passed. Also there are devision and multiplication signs have been modified according to the Russian braille specs.
* Braille - Latin and Greek letters fixes
This commit adds a layer of Latin and Greek alphabets for Russian mathematical Braille.
* In unicode.yaml Latin and Greek letters now go through the internal markers of the alphabetic mode.
• In braille.rs russian_cleanup turns these markers into real signs:
◦ Latin lowercase: ⠠
◦ Latin uppercase: ⠨
◦ Greek lowercase: ⠰
◦ Greek uppercase: ⠸
Added tests to russian.rs to x+A+y+B, the Latin letter after the number.
* Braille - Roots, powers and scripts
This commit adds Roots, powers and scripts according to the Russian math Braille specs.
* Update Russian Braille rules and mappings
Fix YAML replace syntax and extend Russian braille rules: add chemical-formula-operator-bond and prefix-geometry-ops rules, broaden function-name matching (include tg/ctg variants) and add separator markers. Update unicode mappings (degree sign, invisible characters, conditional ∪ mapping, parallel/arrow glyphs) and adjust several function/operator braille outputs. Add/expand tests to cover functions, geometry, matrices and chemical formulas to validate the changes.
* Add Russian language to docs
Add Russian (ru) to the list of supported speech languages and update Russian documentation and translation guidance.
- docs/User_guide_for_MathCAT_en.md, docs/index.md: add Russian (ru) to supported languages lists.
- docs/ru/User_guide_for_MathCAT_ru.md: include Russian in language options, reorder entries and apply minor wording fixes.
- docs/ru/helpers.md: clarify wording, update examples and test instructions to reference ru instead of fr, and improve translation guidance and examples (including test and cargo commands).
- docs/ru/index.md: reorder supported languages and polish phrasing.
These edits enable and document Russian support and improve clarity for translators and developers working on the Russian localization.
* Refactor Russian function braille mapping
Replace hardcoded function-name branches in Russian_Rules.yaml with a DefinitionValue lookup that pulls from a new RussianFunctionBraille mapping. Add RussianFunctionBraille entries to definitions.yaml (private-use codepoints U+E100–U+E10E) and map those codepoints to braille strings in unicode.yaml. Add a test covering tan/cot rendering. This centralizes function braille representations and simplifies the rule logic.
* Refine Russian wording in translators guide
Clarify and naturalize Russian phrasing in the translators guide: add explicit "на русском языке" to SimpleSpeak examples; change exponent wording to "в квадрате" with example "икс в квадрате"; make fraction wording more natural ("числитель разделить на знаменатель" and example "метр за секунду"); fix "английском" → "английском языке"; and update Braille tooling phrasing to "просмотрщиком Брайля" and "дисплее Брайля" for consistency.
* Add alphabet indicators in russian_cleanup
Insert a preprocessing step that injects braille alphabet indicators before running REPLACE_INDICATORS. A new helper add_russian_alphabet_indicators scans the raw braille and emits specific indicators for 'l' (Latin lowercase), 'u' (Latin uppercase), 'g' (Greek lowercase) and 'v' (Greek uppercase), avoiding repeated indicators by tracking the current alphabet mode. The helper also resets the mode on 'C', 'N', and '#'. This keeps the existing indicator replacement and space-collapsing logic intact while preventing redundant alphabet indicators.
* Russian braille: add GOST symbols and decimals
Add GOST-style number and symbol support for Russian braille: introduce a decimal-comma rule that emits BrailleChars for integer and fractional parts with a decimal indicator, using PUA digit placeholders. Extend unicode mappings with bracket/brace/slash/backslash/pipe characters, Celsius, context-sensitive prime (′/″) handling, PUA digit-to-braille mappings, and a few arrow/connective symbols. Update tests to cover decimal numbers, fractions, set notation, Celsius, and logical arrows, and adjust expected output for geometry primes to reflect the new context-aware prime handling.
* Add vector/bar/arc mover rules and tests
Introduce three new mover rules in Rules/Braille/Russian/Russian_Rules.yaml: vector-arrow, vector-bar, and geometry-arc. Each rule detects specific accent characters (arrows: → ⟶ ⇀ ⃗; bars: ¯ ‾ _  ̄; arcs: ⌒ ⏜ ︵) and emits the appropriate braille indicators, using a different form when the base has more than one character. Add corresponding tests in tests/braille/Russian/russian.rs to cover single- and multi-character movers and combined expressions.
* Add Russian braille math functions and limits
Extend Russian braille rules to support additional math functions and large operator limits. Added new rules for large-op-limits, operator/functions (including special handling for div), and div-specific replacements in Rules/Braille/Russian/*. Updated Russian definitions and unicode mappings to include sinh/cosh/tanh/coth, arg/sgn/det/rank/rg, Re/Im, grad/rot/div, gcd/lcm and related braille codes. Updated global Rules/definitions.yaml to recognize new function names. Fixed braille cleanup in src/braille.rs to normalize div encoding. Added unit tests exercising the new function mappings and large operator limits.
* Support system left brace in Russian braille
Introduce handling for system left-brace matrices in the Russian braille rules: add InSystemLeftBrace variable, a system-left-brace-opener rule and a system-left-brace-table rule to detect brace-enclosed mtable as a system. Update row-start logic to emit appropriate braille tokens when InSystemLeftBrace is set. Add tests exercising curly-brace matrices, piecewise function (brace with conditions), and vertical-bar matrices to verify the new behavior.
* Add Russian chemistry braille rules and tests
Extend Russian braille rules to handle chemical notation: add rules for equilibrium-arrow, reaction operators, repeated charges, charges, and charge-with-subscript mappings (chemical-reaction-operator, chemistry-mhchem-equilibrium-arrow, chemistry-repeated-charge, chemistry-charge, chemistry-charge-with-subscript). Update Rules/Braille/Russian/Russian_Rules.yaml to map arrows, +/-, superscripts/subscripts and reaction operators to appropriate braille sequences. Add tests in tests/braille/Russian/russian.rs (source_chemical_reactions_and_charges) covering reaction arrows, charges, subscripts/superscripts and combined examples.
---------
Co-authored-by: Moritz Groß <hi@mgross.dev>
Co-authored-by: nsoiffer <soiffer@alum.mit.edu>
Co-authored-by: Tuomas Pyorre <82783219+ttpyorre@users.noreply.github.com>
Co-authored-by: V3nky <venkatesh6114@gmail.com>
Co-authored-by: Hon-Jang Yang <hjy1210@users.noreply.github.com>
Co-authored-by: nsoiffer <neil.soiffer@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
* Add Russian braille rules for geometry operators
Add three new braille encoding rules for geometry operators (∠, △, ∪) in Russian:
- canonical-prefix-geometry-op: handles geometry operators in canonical form
- geometry-prefix-after-canonical-multiplier: handles operators after canonical multipliers
- geometry-prefix-after-multiplier: handles operators after regular multipliers
Includes corresponding test cases for angles, triangles, unions, perpendicular, and similar symbols.
* Improve Russian braille typeform and mathvariant handling
Refactor Russian braille cleanup to properly handle typeform indicators (bold, italic) and mathvariant attributes. Introduces a dedicated typeform indicator function that manages indicator placement according to Russian Braille ГОСТ Р 58511 standard, separating typeform handling from alphabet indicators. Adds support for automatic typeform indicators based on mathvariant attributes, ensuring proper indicator pairing around content blocks. Updates unicode-full.yaml rules to reflect new typeform codes and adds comprehensive tests for various mathvariant combinations.
* Propagate mathvariant attribute to children
Add mathvariant inheritance from parent elements to children that lack their own mathvariant attribute. This ensures consistent styling throughout nested elements. Includes tests for bold text propagation through mstyle and mrow containers, and verifies that explicit child mathvariants override inherited values.
* Fix clippy warnings and improve code style
- Remove unnecessary borrows in format! and display calls
- Change string slices to arrays in trim_end_matches calls
- Replace expect(&format!(...)) with unwrap_or_else(|_| panic!(...))
- Add clippy allow attributes to suppress false positives in tests
- Add missing newline at end of build.rs
* Remove unnecessary borrows in format macros
Remove redundant `&` reference operators from arguments passed to format! macros and similar functions. These values are automatically borrowed by the format machinery, so explicit borrows are unnecessary and reduce readability.
* Normalize Unicode math digits in decimal numbers
Add normalization of Unicode mathematical alphanumeric symbols (Plane 1 digits) to ASCII digits for number nodes containing decimal points. Skip canonicalize_plane1 processing for already-normalized nodes to prevent double processing.
* Remove unnecessary references and .to_string() calls
Remove unnecessary `&` borrows in format arguments and replace `.to_string()` with direct display. Simplify byte array literals to byte string literals for readability and idiomatic Rust style.
* Remove mathvariant propagation and update tests
Drop implicit propagation of the mathvariant attribute from canonicalization (removed propagate_inherited_mathvariant call and helper functions) and update Russian braille tests to set mathvariant explicitly on elements (replace mstyle with mrow and move attributes to mi). Changes in src/canonicalize.rs and tests/braille/Russian/russian.rs. This makes mathvariant handling explicit in tests and avoids mutating child nodes during canonicalization.
* Remove math digit normalization for mn nodes
Delete the conditional normalization of mathematical digit characters for <mn> text and remove the normalize_math_digits helper from src/canonicalize.rs. Previously the code converted several Unicode math-digit codepoints to ASCII when a decimal point was present.
* Adjust test expectations and unignore tests
Update expected spoken/braille test outputs across multiple language test files to match updated speech rules (punctuation handling, table phrasing, and unit/roman-numeral rendering). Removed several #[ignore] annotations for the previously skipped "ignore_period_and_space" tests. Minor tidy in pl/definitions.rs to avoid unnecessary format! usage and fix EOF newline. Affected files include tests/Languages/* for en, fi, fr, hu, nb, pl, sv, vi, and zh/tw.
* Bump to 0.7.6-beta.8 and update dependencies
Update to version 0.7.6-beta.8 with the following changes:
- Migrate to no-unsafe variants of sxd-document and sxd-xpath
- Add 'no-unsafe' feature flag for unsafe-free builds
- Update dependencies: strum, regex, bitflags, env_logger
- Add tempfile dev-dependency
- Improve build.rs: add rerun-if-changed directives earlier and fix indentation
- Exclude BrailleDocs from package
* Switch to sxd_document_no_unsafe and NameStr
Replace sxd_document/sxd_xpath usages with no-unsafe variants and adapt string types. Key changes in src/braille.rs, src/canonicalize.rs, and src/chemistry.rs: introduce NameStr (feature-gated), use as_str!/as_qname! helpers, convert many attribute_value calls to .as_deref(), update XPath error constructions, and store operator chars as NameStr with PhantomData in OperatorPair. Refactor chemistry tests to helper-based Result flow and use sxd_document_no_unsafe::parser. These edits make the code compatible with the "no-unsafe" pathway and fix lifetime/string mismatches across the codebase.
* Use no-unsafe sxd crates; adapt code & tests
Replace sxd_document/sxd_xpath with sxd_document_no_unsafe and sxd_xpath_no_unsafe and update imports (including parser). Adjust attribute handling and lifetimes: use as_str!, attribute_value(...).as_deref().unwrap_or_default(), and similar changes to avoid unsafe string lifetimes. Refactor tests to return Result, use ? and panic-catching, and update assertions (e.g. is_empty). Re-enable sample MathML in main, tweak timing_test (disable heavy loops, change loop count). Misc small fixes to satisfy the new APIs and lifetime semantics.
* Use no-unsafe sxd libs; refactor TTS & parsing
Switch project XML/XPath handling to sxd_document_no_unsafe / sxd_xpath_no_unsafe and adapt code to use as_str!/as_qname! helpers. Update speech and pretty-print logic to use the new context and node APIs, tighten unicode handling, and add debug checks. Refactor TTS APIs so command value accessors return Result and TTS string builders propagate errors. Update tests and prefs helpers (temporary rules dir helper, prefs test flow). Misc: small capacity tweaks and wording fixes in error messages. Files changed: src/prefs.rs, src/pretty_print.rs, src/speech.rs, src/tts.rs.
* Improve wording in RU user guide
Replace "Трудности в обучении" with "Когнитивные нарушения" in docs/ru/User_guide_for_MathCAT_ru.md to use a more precise and respectful term for users who need shorter spoken output.
* Add Russian GOST-58511 typeform braille rules and tests
Introduce three Russian GOST-58511 typeform/layout braille rules (small-font, letter-spacing, insertion) to Rules/Braille/Russian/Russian_Rules.yaml with their corresponding braille markers. Expand and reorganize tests in tests/braille/Russian/russian.rs: add coverage for the new typeform indicators, interaction cases, menclose/table/braces, and other edge cases; rename several tests to reflect sectioned/aggregated variants. Also adjust expected braille outputs for a few existing tests (sqrt and geometry matrix cases) to match the new rules/formatting.
---------
Co-authored-by: nsoiffer <soiffer@alum.mit.edu>
Co-authored-by: mgros <hi@mgross.dev>
Co-authored-by: Tuomas Pyorre <82783219+ttpyorre@users.noreply.github.com>
Co-authored-by: V3nky <venkatesh6114@gmail.com>
Co-authored-by: Hon-Jang Yang <hjy1210@users.noreply.github.com>
Co-authored-by: nsoiffer <neil.soiffer@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
* force bring over the files from main -- merging didn't do the right thing
* Ru - handle lone log/ln; suppress nav announcements (#681)
* ru: handle lone log/ln; suppress nav announcements
Add handling for lone mi elements 'log' and 'ln' in ClearSpeak (supports Verbosity and ClearSpeak_Log LnAsNaturalLog option). Add a navigation rule to avoid announcing "in/out of" for prefix or silent intents that have no NavigationParts. Include unit tests: new ClearSpeak tests for individual log/ln, new navigate tests for suppressed base announcements, and register the navigate test module.
* Russian braille: bracket/arrow mappings & tests
Add contextual bracket-recognition rules (square and angle) to Rules/Braille/Russian/Russian_Rules.yaml and add Unicode braille mappings for ≶, ≷, ⟨, ⟩, ↑, ↓ in Rules/Braille/Russian/unicode.yaml. Extend tests in tests/braille/Russian/russian.rs to cover Russian Braille GOST 2019 order relations, large vertical arrows, and contextual bracket recognition for square and angle brackets, validating the expected braille output.
---------
Co-authored-by: Danil <81031453+Kostenkov-2021@users.noreply.github.com>
Co-authored-by: mgros <hi@mgross.dev>
Co-authored-by: Tuomas Pyorre <82783219+ttpyorre@users.noreply.github.com>
Co-authored-by: V3nky <venkatesh6114@gmail.com>
Co-authored-by: Hon-Jang Yang <hjy1210@users.noreply.github.com>
Co-authored-by: nsoiffer <neil.soiffer@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
* Remove unused and commented-out code (#680)
* Remove unused and commented-out code in `src/pretty_print.rs`.
* remove more dead sections
* Update demo link in developers documentation
Updated the MathJax demo link to MathCAT demo with additional context.
* Did cleanup with ranges to shrink file size. The big win was the 'id' dir which hadn't had ranges added. That was a 225k reduction. The rest only shortened the files by a bit over 9k.
I also made sure that italic letters did NOT use an italic indicator. Awaiting feedback about whether that is correct for Russian.
The other changes were smaller cleanups including always translating to lowercase letters in letter ranges (by adding "C").
* Announce column separator (#679)
* Add `HasVisibleColumnLine` XPath function to handle table separators in speech output
- Replace `count_table_dims` return type with `usize` values for clarity.
- Update function registration to include `HasVisibleColumnLine`.
- Modify speech tests to reflect separator usage in matrix descriptions.
* Refactor `count_table_dims` to return `Result` type and update usage sites
* undo whitespace change
* .
* .
* explain tests better in comments
* explain tests better in comments
* Add support for row separators and unify boundary line logic
* fix check_table_line helper function
* added a pause before separator announcements
* Change pause duration from medium to short
* Update test cases for matrix representations to add pause before separator
---------
Co-authored-by: NSoiffer <NSoiffer@users.noreply.github.com>
* fix clippy warnings in the no-unsafe version
* Revert changes to file from 6ecc412
* missed this change that needed to be reverted for Russian braille
* fix AGENTS.md instruction on `uv run pytest`
* Merge latest hu changes (#696)
* Add few tweaks into the Rules/Languages/hu/definitions.yaml file, Added missing definitions.rs test file the test/Languages/hu directory, and added SimpleSpeak test directory the mroot and menclose tests (#646)
* Do more localization in Rules/Languages/hu/definitions.yaml
Signed-off-by: Attila Hammer <hammera@pickup.hu>
* Add in Simplespeak tests the definition, mroot and menclose tests
Signed-off-by: Attila Hammer <hammera@pickup.hu>
* fix some werbs in intervals into rules/Languages/hu/ClearSpeak_rules.yaml and SimpleSpeak_rules.yaml
Signed-off-by: Attila Hammer <hammera@pickup.hu>
* Fix tests after interval Clearspeak and SimpleSpeak verb change
Signed-off-by: Attila Hammer <hammera@pickup.hu>
---------
Signed-off-by: Attila Hammer <hammera@pickup.hu>
* Apply Hungarian unicode fixes from PR #673
* Update Hungarian language and test rules from PR #694
* Fix a mistake after the selective merge with definitions.yaml and definition.rs test file (#697)
Signed-off-by: Attila Hammer <hammera@pickup.hu>
---------
Signed-off-by: Attila Hammer <hammera@pickup.hu>
Co-authored-by: hammera <hammera@pickup.hu>
* move to release candidate
* Added creation of minified yaml files for an alternative Rules.zip
* fix build problem
* try again for creation of minified yaml files for an alternative Rules.zip
* try again -- needs to run on linux
* Add standalone Rules packaging script
* try again with more files in github
* try again adding 'zz' test dir for testing
* internally zip of the Language/Braille dirs
* add another file for packaging the rules
* trying again with zipping -- AI is not doing a very good job...
* Merged the messy multiple files AI created into one file
* AI keeps messing with things it shouldn't...
* remove inappropriate check
* Unify Rules packaging in Rust for CI, include-zip, and release zips.
Replace the Python packager with shared rules_archive logic and a package-rules binary so build.rs, downloadable archives, and the include-zip embed use one layout (inner BZIP2; outer DEFLATE for unzip-friendly downloads). Serialize parallel language unzip during tests to avoid corrupting the shared Rules tree.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Serialize rules unzip and YAML reads during parallel tests
Co-authored-by: Cursor <cursoragent@cursor.com>
* update version number
* better speech for missing char used for parsing
* udate version #
* Add option --exclude to audit-translations
* Add tests for --exclude option
* Add test case IDs for CLI main exclude tests
* fix minimized zip file so that flow style is used to reduce space
* fix test that depending on the details of YAML notation -- broke for compact flow notation
* fix row terminator for UEB in mtable
* fix row terminator for UEB in mtable
* Bring over fixes to the minified yaml files.
* bump release number
* Fix #698 -- merge arc-like symbols under restricted condidtions
* Update user guide
Updated English user guide with info on how to use MathCAT as an addon in NVDA.
* Updated acknowledgements
Updated acknowledgements with French, Hungarian and Polish translators.
* fix #703
* Fix up UEB mtable notations.
There are made up rules (awaiting feedback from ICEB) about how to represent the start of a new row in linear form.
add two dot-like characters used in an ellision example in a matrix
* accidentally picked up wrong version # when merged in release-candidate
* bump version #
* add Math4VIP to German translators
* Fix up arc look-alike chars due to canonicalize change.
Remove duplicate char definitions in unicode files.
* fixes no-unsafe branch clippy issues
* Update MathCAT logo and add descriptive alt text. (#714)
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix clippy warning with new version of rust
* tried to align the MathCAT logo with the following text.
* Add logo-inline.png for README and GitHub Pages docs
* Cred to Greek translators
* Fix outdated MathCAT project URLs (#732)
Co-authored-by: k4its1t <306379390+k4its1t@users.noreply.github.com>
* Add Brazilian Portuguese (pt) translation- #729 (#736)
* Create test
* Traducao das regras pt-BR: unicode, definitions, SimpleSpeak, SharedRules e testes
* Versão inicial em português do MathCAT
* Corrige bugs da auditoria e traduz unicode-full.yaml (acentos, setas, operadores, formas)
* Regras da rodada de testes: probability, ignore_period, unicode-full
* Corrige unidades sec/arcsec, remove dot-over espúria, ACHADOS.md
* pt: corrige 7 bugs de regra e reconcilia os testes (92/92)
cargo test Languages::pt saía de 33 falhas em 91 testes. Agora passa 92/92,
e a suíte inteira do repositório continua verde. Nada em src/ foi tocado.
Bugs de regra:
- SharedRules/general.yaml: a distinção Verbose/Medium tinha desabado na
química. 14 pares de ramos diziam "subscrito"/"sobrescrito" nos dois
níveis, onde o inglês tem subscript/sub. Um deles (ramo $Prescripts[4])
dizia "subscrito" onde o inglês diz superscript.
- SharedRules/general.yaml: ligação dupla escrita "::" não era reconhecida.
A regra testava .='::', mas o canonicalizador converte para ∷ (U+2237)
antes de as regras rodarem, então H₂C::CH₂ saía "maiúsculo c, como
maiúsculo c".
- unicode.yaml: a regra de "|" era uma simplificação da inglesa e perdia
três casos — P(A|B) ("dado"), a|b entre números ("divide") e o intent
literal. Portada a estrutura inglesa inteira.
- SharedRules/general.yaml: <none/> fora da química caía no default-text,
que fala o nome da tag, e saía a palavra inglesa "none". Agora "nenhum".
- SharedRules/general.yaml: faltava o Log maiúsculo (valor principal), que
saía "Log de x". Marcado t: — a tradução precisa de conferência.
- definitions.yaml: "segundo de arco" estava duplicado em PluralForms. O
leitor de YAML do Rust aceita, mas audit-translations recusava o arquivo
inteiro, ou seja, definitions.yaml não estava sendo auditado de verdade.
- definitions.yaml: plurais das formas prefixadas de "segundo de arco", que
a regra genérica produzia como "yoctossegundo de arcos".
Testes desatualizados: pausas geradas pelo motor (ver ACHADOS.md seção 1),
o artigo em "o log de x", "1 meio" em vez de "um meio", "l n x" no modo
conciso, e a vírgula do grego (que o teste inglês também tem).
Decisão: menos unário fica "menos", não "negativo". Os testes estavam
divididos; a regra já dizia "menos" e os três discordantes foram alinhados.
Resolve duas pendências do ACHADOS.md: a contradição aparente entre
tensor_mmultiscripts e mhchem_so4_2mais (caminhos de código diferentes — só
o da química estava quebrado) e a divergência de inverse_trig entre
SimpleSpeak e ClearSpeak (as regras já estavam alinhadas; era o teste).
ACHADOS.md ganha a seção 6. Corrigidas duas afirmações das seções
anteriores: compute_auto_pause conta bytes, não letras; e as regras de
química não eram idênticas às inglesas (só as diretivas de pausa eram).
Registrado também que trocar bytes por caracteres foi testado e não
resolve — piora de 15 para 36 falhas.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* Terminologia: maiúscula, romanos por valor, expoente zero cardinal, testes
* pt: pertinência sem verbo finito dentro de conjunto; ∉ com In deixa de colidir com ⊄
Duas correções de fala, com varredura e não caso a caso (ACHADOS 7.8/7.9):
1. Dentro de um conjunto ({x ∈ ℤ : x > 5}) a expressão modifica "todos os x"
e não pode ter verbo finito nem singular: o verbo grudava em "conjunto"
("o conjunto de todos os x pertence a inteiros"). Seis dos oito ramos
estavam errados, não só o Belongs. Agora: em / membros de / elementos de /
pertencentes a, e as negações nominais. "fora de" foi rejeitado por trocar
pertinência por localização; "não em" por ser truncado. O ramo SimpleSpeak
usava uma string só para dentro e fora e passou a bifurcar.
2. ∉ com ClearSpeak_SetMemberSymbol=In fora de conjunto falava "não está
contido em", exatamente a fala do ⊄. Passa a "não está em", espelhando o ∈.
Também nesta rodada, já em varredura: termo único por família de estilo
(fraktur, caligráfico) e adjetivo posposto nos dois arquivos; ∈ ∊ com Auto
separado de Member como o ∉; ! volta a distinguir literal/fatorial; ≇ ≚ ≞ ⋕
com termo matemático em vez do nome Unicode; cópula dupla em ∦ ⊈ ⊉.
Novo: tests/Languages/pt/ClearSpeak/sets.rs (pt vai de 102 para 142 testes,
∈ e ∊ travados iguais nas cinco preferências e nos dois estilos),
PythonScripts/conferir_vocabulario.py (consistência de vocabulário entre
unicode.yaml e unicode-full.yaml: 8 -> 4 grupos, restantes benignos) e
Rules/Languages/pt/TERMINOLOGIA_PT_BR.md (registro único das leituras).
Suíte inteira: 7307 passed, 0 failed.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0134dJm6wzqbquvZrNhPD3Ea
* pt: corrige o que o material real do ACESSÍLIA exige; recuo controlado; pacote de escuta
Diagnóstico antes de escolher (ACHADOS 9): o MathML do ACESSÍLIA vem do
latex2mathml nos dois caminhos (inclusive Docling) e nunca traz intent=, então
os 186 IntentMappings ausentes não são prioridade. O que importa é o que o
motor infere sozinho e o que sai cru para o sintetizador.
Correções, pelo dano ao estudante:
- caracteres crus no corpus real: negrito latino e grego (\mathbf, \boldsymbol),
⟨ ⟩, ¯ de \bar{x} (o motor canonicaliza U+0304/U+203E para U+00AF, então a
entrada "com mácron" nunca era alcançada), setas longas, µ Ω ℧ Å soltos
- "1 terceiro" -> "1 terço": listas fracionárias paravam em "meio"
- "o integral" -> "a integral": artigo concorda com o operador grande
- "magnitude de x" -> "a norma de x": intent inferido sem mapping pt
- "cross product"/"dot product" literais -> "produto vetorial/escalar": o
intent inferido vem sem filhos e nenhuma regra casava com count(*)=0
- recuo controlado só em regra (gerar_recuo_en.py): 2091 entradas do en para
codepoints sem cobertura, estilo já definido traduzido, resto em t: minúsculo.
Antes o caractere saía cru; agora sai em inglês, contado como pendente.
Pacote da sessão de escuta (gerar_pacote_escuta.py -> SESSAO_ESCUTA.md): 30
expressões em 6 áreas, fala real nos dois estilos e três verbosidades, roteiro
e tabela das decisões que dependem do ouvinte.
cargo test: 7307 passed, 0 failed (pt: 142). conferir_vocabulario.py: 4 grupos,
todos benignos, antes e depois.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0134dJm6wzqbquvZrNhPD3Ea
* pt: P(A ∣ B) fala "dado"; varredura de vazamento nas 593 expressões do en
O latex2mathml emite \mid como U+2223, não "|": P(A ∣ B) saía "A divide B".
A entrada "∣" ganha a mesma condição de contexto da regra do "|" (dentro de
P( · ∣ · ) é "dado"; fora continua "divide"). Em conjunto por compreensão
{x ∣ ...} o problema persiste e não é regra: o canonicalizador só trata "|"
como cerca (registrado como item de src/ em ACHADOS 9.6).
Varredura: as 593 expressões dos testes do inglês faladas em português, à
procura de palavras inglesas. Fora dos <mtext> em inglês dos próprios testes
e das letras decoradas, nenhum vazamento em material real. As decorações
(circulado, entre parênteses, com ponto, invertido) entraram no mapa de
estilo do recuo controlado.
cargo test: 7307 passed, 0 failed (pt: 142). conferir_vocabulario.py: 4.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0134dJm6wzqbquvZrNhPD3Ea
* pt: recuo marcado # RECUO-EN e separado da tradução pendente; regressão do recuo = 0
As entradas do recuo controlado usavam t: minúsculo, a mesma marca de
"traduzido mas não conferido" — 2 mil delas contra 20 pendências reais, que
sumiam no meio. Cada entrada do bloco leva agora # RECUO-EN na linha da chave
e o conferir_vocabulario.py ganhou a seção 5, que reporta os dois números em
separado: 2091 entradas de recuo (1980 strings em inglês) contra 20 strings
pendentes de conferência (fraktur x10, caligráfico x10).
Verificação de regressão: as 593 expressões dos testes do en faladas em pt
sem e com o bloco. 526 iguais; 67 mudaram, todas com caractere cru antes.
Nenhuma expressão 100% português mudou de fala.
cargo test: 7307 passed, 0 failed (pt: 142). conferir_vocabulario.py: 4.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0134dJm6wzqbquvZrNhPD3Ea
* Delete auditar_pt.sh
* Delete Rules/Languages/pt/ACHADOS.md
* Delete Rules/Languages/pt/SESSAO_ESCUTA.md
* Delete Rules/Languages/pt/TERMINOLOGIA_PT_BR.md
* Terminologia: maiúscula, romanos por valor, expoente zero cardinal, testes
* Restaura arquivos apagados por engano
* Delete venv directory
* Delete PythonScripts/venv directory
* Delete PythonScripts/gerar_recuo_en.py
* Delete PythonScripts/gerar_pacote_escuta.py
* Delete PythonScripts/conferir_vocabulario.py
* Remove translation correction comments from YAML
Removed comments regarding translation corrections and pluralization issues.
* Clean up comments in ClearSpeak_Rules.yaml
Removed comments regarding corrections in Portuguese grammar and terminology for mathematical expressions.
* Clean up comments in SimpleSpeak_Rules.yaml
Removed comments regarding corrections related to gendered ordinal numbers and unnecessary English suffixes.
* Clean up translation notes in definitions.yaml
Removed translation notes and comments from definitions.yaml.
* Fix tag for overview-default in overview.yaml
Corrected the tag for 'overview-default' to include 'fraction' for better intent matching.
* Clean up comments in escuta.rs
Removed comments and documentation from escuta.rs.
* Update expressions in escuta_expressoes.tsv
* Clean up comments in intent.rs
Removed cautionary comments regarding the Spanish equivalent tests and their historical inaccuracies.
* Remove venv from version control
* Restringe o PR a Rules/Languages/pt e tests/Languages/pt
Reverte o .gitignore à versão do upstream; arquivos locais (venv, saídas
de teste, scripts auxiliares e documentos .md) ficam fora do controle de
versão via .git/info/exclude.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VJN43HMwJHeagwCporXvF3
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* Release candidate (#743)
* Add UEB G1 BANA/GTM mode preference and expand Grade-2 contractions.
Adding the preference is a stall tactic while I wait for feedback from ICEB about whether BANA rules are obsolete.
Introduce UEB_G1_BANA_Style (default true) to choose BANA 2019 vs ICEB GTM
1.7.3/1.7.5 grade-1 indicator placement in ueb_cleanup. Implement GTM 1.7
per-symbols-sequence counting with gtm_1_7_mode, and add matching ICEB tests.
Extend handle_contractions for technical vocabulary: UEB 10.8 final-letter
groupsigns, dot-5 through/part, dis/con prefixes, cc/ea exception words, and
a ful-pattern fix. Add ueb_technical_word_contractions (311 words, goldens
cross-checked with brailletranslators.com). Wire the preference through
prefs, fuzz, and docs.
* updated to new BANA and ICEB spec updates. Five tests fail. Still working on them
* removed an option
* fix contractions involving 'be, con, dis' which can only be at the start of a 'word' (where 'word' has a specific UEB meaning)
* Updated to UEB to the latest guidance for grade 1 indicators. This adds new tests and changes a few tests.
Also added more contractions.
* update rc #
* fix new clippy warnings
* fix up Vietanmese tests
* fix str compile issue with no-unsafe feature
* pl: fix five speech/navigation defects and catch up with recent en changes (#738)
* pl: speak up tack (U+22A5) as perpendicular, matching en
Follow-up to 45aefb2d for Polish. Editors commonly emit U+22A5 where
perpendicularity is meant, so both U+27C2 and U+22A5 now say
"jest prostopadle do". LiteralSpeak keeps reading U+22A5 literally
as "dol".
Previously Polish said "dol" for U+22A5, so the same formula was read
differently in Polish than in English.
Adds up_tack_330 to tests/Languages/pl/alphabets.rs, mirroring the
English test.
* pl: adopt the `|` argument-glue syntax from definitions.yaml
Follow-up to 4347d884 for Polish. That commit added the `|` syntax and
updated the Polish tests, but not the Polish rule files, so several
intents lost their function name in speech.
Fixed, with the spoken output before -> after:
quotient "podzielone przez z x przecinek, y"
-> "czesc calkowita z x podzielone przez y"
remainder "podzielone przez z x przecinek, y"
-> "reszta z x podzielone przez y"
set-difference "i z wielka a przecinek, wielka b"
-> "roznica zbiorow z wielka a i wielka b"
polar-coordinate "przecinek z x przecinek, y"
-> "wspolrzedna biegunowa z x przecinek, y"
The `|` syntax needs the function-intent rule to call
IntentFunctionUseArityPath / IntentFunctionGlueBefore. Only en and hu
had it, so it is now ported to pl (with "of" -> "z").
Also here:
* SharedRules/geometry.yaml: the `coordinate` rule matched "." instead
of "not(*[@arg])", so it swallowed coordinate($x,...) intents that
should fall through to IntentMappings. Its name was also mistranslated
as "przecinek" (comma) rather than "punkt" (point).
* transpose: fixity order now matches en (postfix first). The
function form is tested explicitly via intent='transpose:function($x)',
as en does.
* empty-set: added, it was missing.
NOT adopted: arity templates ("| po | od,do") for sum/product.
intent_function_glue_before in src/infer_intent.rs hardcodes the English
word "of" for the last argument, which yields "suma po i of x" in Polish.
This affects every non-English language; hu avoids it the same way. The
binary separator form works correctly and is what this commit uses.
* pl: fix navigation direction words, unreachable for any translation
Follow-up to ec36e057 and 080ca162 for Polish, but it also fixes a
long-standing Polish bug rather than only porting the new code.
navigate.yaml compared the suffix of $NavCommand (always English, e.g.
"ZoomIn") against a substring offset by the length of the SPOKEN $Prefix.
For English those are the same; for any translation they are not. With
"przybliz" (8 chars) vs "Zoom" (4), "ZoomIn" was cut to "" instead of
"In", so ALL 16 branches were dead:
ZoomIn -> "" (want "In")
ZoomOutAll -> "ll" (want "OutAll")
MoveNext -> "t" (want "Next")
DescribeNext -> "ibeNext" (want "Next")
Users heard "przejdz; do mianownika" with no direction, never
"przejdz w prawo". Using $CommandOffset, as ec36e057 introduced, fixes
all of them.
Two more things here:
* Polish needs two verbs where English reuses "zoom": "przybliz na
zewnatrz" (zoom in outwards) is self-contradictory, so ZoomOut* now
says "oddal". The direction word for plain In/Out is dropped, as the
verb already carries it: "przybliz" / "oddal", and
"przybliz maksymalnie" / "oddal maksymalnie".
* Ports into-or-out-of-prefix-or-silent-without-parts (080ca162) and the
SpeakIntentName fallbacks in into-or-out-of-default, keeping our own
Polish preposition logic (including "ze stopnia" euphony).
Adds zoom_speech_pl and move_char_speech_pl. Both fail on the old
formula, showing the missing direction word, so they do discriminate.
* pl: announce table column and row separators
Follow-up to fbc49bb7 (#679) for Polish. The HasVisibleColumnLine /
HasVisibleRowLine rules were missing from pl/SharedRules/default.yaml,
so visible lines in a matrix were silent for Polish users, e.g. an
augmented matrix was read exactly like a plain one.
before: "2 na 3 macierz rozszerzona; wiersz 1; 3, 1, 4; ..."
after: "2 na 3 macierz rozszerzona; wiersz 1; 3, 1, separator, 4; ..."
Two existing tests (augmented_matrix_2x3, augmented_matrix_3x4_end_matrix)
were pinning the pre-#679 output; their English counterparts already
expect "separator", so they are updated rather than worked around.
Adds dashed_augmented_matrix_separator and matrix_row_separator,
ported from tests/Languages/en/mtable.rs. Removing either rule fails
all four tests, so they discriminate.
* pl: clear the remaining untranslated unicode entries
The audit tool reported 81 unicode entries whose text equals the English
source. Reviewing them one by one, only two were actually untranslated:
U+2127 "mhos" -> "mho" (unit, as nb and sv have it)
U+2644 "Saturn" (Polish spelling is the same; key raised)
The other 75 are correct as-is and only needed the verified key:
* 30 Roman numerals (U+2160..U+217F) spelled out letter by letter
* 29 space, PUA and zero-width entries with no speech at all
* 6 typographic ligatures (ff, fl, ffi, ffl, ft, st)
* 10 proper names and symbols (spesmilos, paragraphos, hypodiastole,
digamma, differential d, imaginary j, oV, pH)
Four more in unicode.yaml (digit separator, space, U+2062, U+2063)
likewise carry no translatable speech.
Raising the key on an entry whose text legitimately matches English is
what the convention is for; it is not the same as marking English text
as verified. Only the wording of "mhos" changed - the diff is otherwise
key case only, checked line by line.
Audit's "untranslated" for unicode files: 81 -> 0.
* pl: inflect unit names according to the numeral, not with an English "s" (#744)
* pl: mark the unicode translations as verified (t -> T)
Mechanical change: 2435 text keys raised from t/ot/ct to T/OT/CT in the
two unicode files. No text is touched.
The Polish rules were written before the lowercase/uppercase convention
was in use, so entries that have been translated all along still carried
the "needs review" key. The audit tool therefore reported them as
untranslated, which made the real gaps impossible to see:
audit-translations pl, untranslated text: 3162 -> 727
The remaining 727 are in the rule files, where the entries need reading
rather than a mechanical pass, so they are deliberately left alone.
Every raised entry was checked to differ from the English source, i.e.
it really is translated. Entries whose text legitimately equals English
(Roman numerals, ligatures, proper names, whitespace) were handled
separately in the previous PR; entries still holding English text are
NOT raised, since that would assert a translation that does not exist.
Verification:
cargo test --test languages Languages::pl 609 passed, 0 failed
diff: 2436 insertions, 2436 deletions, zero changes outside key case
The last point is checked by normalising the key case in the diff and
confirming no unpaired lines remain (without normalising, 4710 remain,
so the check does discriminate).
* pl: also mark the multi-line unicode entries as verified
The previous commit raised the key on entries written on a single line
(`- "±": [t: "..."]`), but not on entries whose body is a block:
- "°":
- test:
if: "parent::*[name(.)='msup' ...]"
then: [t: "stopni"]
else: [t: "stopień"]
Those are exactly the entries carrying inflection or a TTS condition, so
312 of the most deliberate translations in the file were left looking
unreviewed. This raises them: 64 in unicode.yaml, 247 in unicode-full.yaml
and one single-line entry (U+23E6) missed earlier.
One entry is deliberately left with a lower-case key: `t: ""` for U+00A0,
the else-branch of the `@data-empty-in-2D` test. That is silence rather
than text, and an upper-case key means "a translator checked this
wording" - there is no wording to check. English keeps a lower-case key
there too.
No content changes; only key case. `cargo test --test languages
Languages::pl` gives 609 passed, 0 failed, which is the same result as
before this commit, as expected for a change the engine treats as
equivalent (src/speech.rs matches "t"|"T" in one match arm).
* pl: raise the remaining rule-file keys and test the number-set rules
Two loose ends in the Polish localization.
**Rule-file keys.** 248 entries in the rule files still used a lower-case
key while carrying translated Polish text. Content is untouched - every
one of the 248 changed lines differs from its predecessor only in the
case of the key name, verified line by line after normalizing the key.
17 entries are deliberately left lower-case: five are the letters C, N,
Q, R, Z in `dimension-number-sets` (the letter itself is the wording, as
in English); `ct: "s"`/`ct: "-"` in the unit rule are the plural suffix
and prefix separator; `navigate.yaml:176` is a Polish euphony variant
("ze" before "st-"); the remaining seven are XPath expressions rather
than speech.
**Tests for the number-set rules.** These rules had no Polish test at
all, in a file where two silent defects were already found. New
`tests/Languages/pl/number_sets.rs` covers the bare symbols, the
dimension form, both sign variants, and ClearSpeak agreeing with
SimpleSpeak.
The `number_set_with_variable_exponent` case is the negative control:
`dimension-number-sets` fires on `count(*)=2`, so a non-numeric exponent
must fall through to the full phrase ("liczby całkowite do potęgi n")
rather than being read as a dimension. Without it, a rule that swallowed
every superscript would still pass.
Polish keeps the letter with a dimension ("R 3"), matching en, de, fr,
nb, sv, fi and es; Hungarian is the only language that translates in that
position too. Measured with the SAPI voice NVDA actually uses: "R 3" is
byte-identical to a phonetic "er 3" and "N 4" to "en 4", so the letters
are pronounced as their Polish names.
cargo test --test languages Languages::pl 614 passed, 0 failed
* pl: inflect unit names according to the numeral, not with an English "s"
The `unit` rule appended `ct: "s"` whenever a unit had no entry in
`PluralForms`, and the Polish `PluralForms` contained no SI base unit at
all. Measured output of the engine before this change:
1 metr, 2 metrs, 5 metrs, 21 metrs, 2 grams, 2 sekundas,
2 ampers, 2 mols, 2 kilo-metrs
So a Polish NVDA user heard an English plural ending on essentially every
quantity. Hungarian avoids this with `CT: ""` (it appends nothing);
French and German legitimately use "s"; Russian, whose plurals work like
Polish, does not rely on a suffix at all and fills in `PluralForms`
instead. Polish was in the wrong group.
Polish does not have one plural form. The noun follows the numeral:
1 metr | 2, 3, 4 metry (nominative plural) | 5 metrów (genitive plural)
and the teens are the exception that breaks the naive rule: 12, 13, 14
metrów, likewise 112-114, while 22 and 102 take the nominative again.
One extra plural column is therefore not enough, so this adds a second
definition section, `PluralGenitive`, next to `PluralForms` (now the
nominative plural). No Rust change is needed: `build_values` accepts any
definition name as a hashmap.
The `unit` rule (both the bare and the prefixed branch) and the
`currency` rule now read the value of the numeral and pick the section
accordingly. When the numeral cannot be determined - a variable
coefficient, as in "x ms" - `$Coefficient` is 0 and the genitive is
used, which is also what Polish uses for unknown quantities ("x
mili-sekund").
Where no inflected form is known the singular is spoken rather than a
guessed ending: a wrong ending is worse for a screen reader user than a
missing one.
Both sections cover all 131 unit and currency names that the Polish
`SIUnits`, `UnitsWithoutPrefixes`, `EnglishUnits` and `CurrencySymbols`
can produce. The forms are written out because Polish inflection cannot
be derived from the ending: metr/metry but litr/litry, om/omy,
dzień/dni, tydzień/tygodnie, rok/lata. Multi-word units inflect the head
noun and keep the dependent word's case ("5 lat świetlnych", "5 minut
łuku"). They were checked against hunspell pl_PL; the only words it does
not know are the binary-prefix neologisms (kibibajt, gibibit, ...) whose
singular forms already existed in the file.
Three base forms were themselves wrong - plurals used as singulars, so
the engine said "1 herce" and "1 konie mechaniczne":
Hz herce -> herc
hp konie mechaniczne -> koń mechaniczny
℧ M h o -> mho
Every other language has a singular here (en hertz, ru герц, fi hertsi,
es hercio; hp: ru "лошадиная сила", hu "lóerő", nb "hestekraft"; ℧:
de/fr "mho").
Why this survived: the existing Polish expectations in
tests/Languages/pl/units.rs recorded the broken output, so 609 tests
passed while the speech was wrong ("2 dzieńs", "2 tydzieńs",
"kwetta-grams"). Expectations harvested from real engine output are a
good regression net but prove nothing about correctness unless they are
read as a user would hear them. 21 test expectations are updated here,
each difference reviewed word by word.
Verification:
cargo test --test languages Languages::pl 615 passed, 0 failed
reverting general.yaml alone -> 6 of 6 new tests fail
The new tests in tests/Languages/pl/unit_plurals.rs cover one class of
phenomenon each: the three numeral classes including the teens
exception, SI base units, the prefixed branch of the rule, irregular
nouns, the corrected base forms, and multi-word units.
* pl: speak the unit after "na" in the accusative, not the nominative (#745)
* pl: mark the unicode translations as verified (t -> T)
Mechanical change: 2435 text keys raised from t/ot/ct to T/OT/CT in the
two unicode files. No text is touched.
The Polish rules were written before the lowercase/uppercase convention
was in use, so entries that have been translated all along still carried
the "needs review" key. The audit tool therefore reported them as
untranslated, which made the real gaps impossible to see:
audit-translations pl, untranslated text: 3162 -> 727
The remaining 727 are in the rule files, where the entries need reading
rather than a mechanical pass, so they are deliberately left alone.
Every raised entry was checked to differ from the English source, i.e.
it really is translated. Entries whose text legitimately equals English
(Roman numerals, ligatures, proper names, whitespace) were handled
separately in the previous PR; entries still holding English text are
NOT raised, since that would assert a translation that does not exist.
Verification:
cargo test --test languages Languages::pl 609 passed, 0 failed
diff: 2436 insertions, 2436 deletions, zero changes outside key case
The last point is checked by normalising the key case in the diff and
confirming no unpaired lines remain (without normalising, 4710 remain,
so the check does discriminate).
* pl: also mark the multi-line unicode entries as verified
The previous commit raised the key on entries written on a single line
(`- "±": [t: "..."]`), but not on entries whose body is a block:
- "°":
- test:
if: "parent::*[name(.)='msup' ...]"
then: [t: "stopni"]
else: [t: "stopień"]
Those are exactly the entries carrying inflection or a TTS condition, so
312 of the most deliberate translations in the file were left looking
unreviewed. This raises them: 64 in unicode.yaml, 247 in unicode-full.yaml
and one single-line entry (U+23E6) missed earlier.
One entry is deliberately left with a lower-case key: `t: ""` for U+00A0,
the else-branch of the `@data-empty-in-2D` test. That is silence rather
than text, and an upper-case key means "a translator checked this
wording" - there is no wording to check. English keeps a lower-case key
there too.
No content changes; only key case. `cargo test --test languages
Languages::pl` gives 609 passed, 0 failed, which is the same result as
before this commit, as expected for a change the engine treats as
equivalent (src/speech.rs matches "t"|"T" in one match arm).
* pl: raise the remaining rule-file keys and test the number-set rules
Two loose ends in the Polish localization.
**Rule-file keys.** 248 entries in the rule files still used a lower-case
key while carrying translated Polish text. Content is untouched - every
one of the 248 changed lines differs from its predecessor only in the
case of the key name, verified line by line after normalizing the key.
17 entries are deliberately left lower-case: five are the letters C, N,
Q, R, Z in `dimension-number-sets` (the letter itself is the wording, as
in English); `ct: "s"`/`ct: "-"` in the unit rule are the plural suffix
and prefix separator; `navigate.yaml:176` is a Polish euphony variant
("ze" before "st-"); the remaining seven are XPath expressions rather
than speech.
**Tests for the number-set rules.** These rules had no Polish test at
all, in a file where two silent defects were already found. New
`tests/Languages/pl/number_sets.rs` covers the bare symbols, the
dimension form, both sign variants, and ClearSpeak agreeing with
SimpleSpeak.
The `number_set_with_variable_exponent` case is the negative control:
`dimension-number-sets` fires on `count(*)=2`, so a non-numeric exponent
must fall through to the full phrase ("liczby całkowite do potęgi n")
rather than being read as a dimension. Without it, a rule that swallowed
every superscript would still pass.
Polish keeps the letter with a dimension ("R 3"), matching en, de, fr,
nb, sv, fi and es; Hungarian is the only language that translates in that
position too. Measured with the SAPI voice NVDA actually uses: "R 3" is
byte-identical to a phonetic "er 3" and "N 4" to "en 4", so the letters
are pronounced as their Polish names.
cargo test --test languages Languages::pl 614 passed, 0 failed
* pl: inflect unit names according to the numeral, not with an English "s"
The `unit` rule appended `ct: "s"` whenever a unit had no entry in
`PluralForms`, and the Polish `PluralForms` contained no SI base un…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I added the examples from the issue as regression tests.
Generally it looks like the detection of Roman numerals should be more conservative.
tbh I'm not really happy how this seems to be handled within MathML, but I guess we have to work with what we're given.
The tests should be ready to go as they are, but I doubt the code changes are ideal.
I only just learned that there's an intent attribute, and that chemistry apparently uses roman numerals for oxidation numbers?!? (well at least that's one way to get some more general knowledge, yesterday I learned what a katal is)