Skip to content

feat(ml): encode native review round 2 — glossary v0.4.0, rules 18 → ~25, first deterministic ml lints #296

Description

@mmcky

Round 2 of the Malayalam calibration programme (Phase 2 of #189) is reviewed: Adisankar left 118 committable suggestion blocks on QuantEcon/lecture-python-programming.ml#7 (functions, regenerated at 8625221 with glossary v0.3.0 + the 18-rule set from #272). Per-flag dispositions, class analysis and the evidence behind every item below are in QuantEcon/project-translation reports/2026-09-01-ml-functions-review-disposition.md. Headline: the round-1 rules held — no recurrence of below-deixis, ordinal, light-verb, -യുടെ or suffixed-English flags across the lecture — and the new classes are mostly deterministic. Proposed dispositions: 75 rule / 19 glossary / 24 accepted-as-is. This issue also absorbs the v0.3.1 candidates parked in #273's body and QuantEcon/project-translation#44: the majority-technical-bullet rule and the line/lines pin are both field-corroborated; the In fact calque had no instance to test.

Rules (src/language-config.ts, ml.additionalRules)

  1. Terminal punctuation (26 flags): every prose paragraph ends with a full stop; a sentence introducing a following code cell, list or displayed equation ends with a colon — regardless of the English source's punctuation; a fronted ശ്രദ്ധിക്കുക, (note that) or ഓർക്കുക: (recall that) carries its own punctuation.
  2. Sentence-initial capitalisation (14): a retained-English word opening a Malayalam sentence or list item — including inside {ref}/{doc} link text — is capitalised (Functions-നെ, Built-in, Return statement, Order, User-defined).
  3. Hortative teacher voice (12): we will / we'll / let's / we nowനമുക്ക് … -ആം (കാണാം, നോക്കാം, എഴുതാം, ചെയ്യാം), never നമ്മൾ … -ും; discuss / see / show as lecture verbs → നോക്കാം / കാണാം; consider the following …താഴെ … നോക്കാം; a lecture-overview list is in the present (പഠിക്കുന്നു). Extends rule 11 with ~10 before/after pairs from the round.
  4. Accusative consistency (15): the object of any transitive light verb takes -നെ, plurals included (functions-നെ define, code-നെ simplify, conditionals-നെ ഒഴിവാക്കാം); no additive -ഉം on bullet-list items; coordinated code names → `a`, `b` എന്നിവ; a call to XX-നെ call ചെയ്യുമ്പോൾ. Tightens rule 3.
  5. Fixed pairs (10): a given Nതന്നിരിക്കുന്ന N, never ഒരു നൽകിയ N; consider X (invitation to look) → X നോക്കാം / consider ചെയ്യുക, with കണക്കിലെടുക്കുക reserved for "take into account"; in one lineഒറ്റ line-ൽ; spelling കുറച്ചുകൂടി.
  6. Sandwich sentences (3): when a source sentence is interrupted by code cells ("these definitions [cell] and [cell] are equivalent"), state the whole claim before the first cell and emit nothing between or after the cells — a verb-final fragment after the second cell is unnatural in SOV order.
  7. Discourse connectives, extension (7): sentence-initial For example, ⏳ (Q1), In particular,, Obviously,, Basically, stay English, alongside the existing In fact / On the other hand.
  8. Exercise-statement scope, extension of D-2026-08-17 (12) — ruled and accepted by @mmcky 2026-09-01, decision record D-2026-09-01-ml-exercise-statements-stay-english (rides the encoding PR): exercise statements whose content is probabilistic or mathematical reasoning stay English; a mixed sentence keeps its mathematical clause English and translates its programming-instruction clause; pointer sentences (Here's a function for the first random device.) stay English. Also reinforce rule 6 with the three misses as worked examples (`plot(x, 'b-')` differs from `plot('b-', x)`, the two pointer sentences).

Glossary (glossary/ml.json → v0.4.0)

  • Keep-English pins: useful (×4), already (×4 ⏳ Q3), name — the noun for a bound identifier; പേര് remains for the act of naming (×5 ⏳ Q5), example / examples (×3 ⏳ Q2), provide, exist, work (⏳ Q4 — reviewer kept പ്രവർത്തിക്കുന്നു 2:1), automatically, create, improve, full, stage, answer, successive, and the corroborated line / lines.
  • Avoid-renderings (a new optional avoid field, or context text the lint reads): ഉപയോഗപ്രദമായ, ഇതിനകം, നിലവിലുണ്ട്, സൃഷ്ടിക്കുക, ഒരു നൽകിയ, കണക്കിലെടുക്കുക (invitation sense), കുറച്ചുകൂടെ, plus round 1's ആവശ്യപ്പെടുന്നു and കൈകാര്യം.
  • Everyday-Malayalam entries (reverse direction, rule-5 class): straightforwardഎളുപ്പം; contrivedകൃത്രിമം; limitedപരിമിതി; facilitateസഹായിക്കുക; hit / reach (a return statement) → എത്തിച്ചേരുക; a bad ideaഅത്ര നല്ലതല്ല.

Deterministic checks (prototype in ml_metrics, candidates for diff-checks.ts graduation under #189 Phase 3)

  • (i) terminal punctuation on prose paragraphs adjacent to fenced cells / lists;
  • (ii) a prose line or list item beginning with a lowercase Latin letter;
  • (iii) banned-rendering substrings driven from the glossary's avoid entries;
  • (iv) the നമ്മൾ … -ും future-hortative pattern — prototype only, expected to be noisy.

These are string checks, not ratios, so they are unaffected by #240 (homograph retention) and #229 (script-ratio band) and can run on every ml sync PR as soon as they exist.

Verification

  • Harness-first per standing policy (test-translation-sync.ml).
  • Regeneration check as dev(ml): archive the round-1 regeneration arm — the rules generalise (#189 Phase 2 close) #273 did for round 1: translate functions from lecture-python-programming@81d9734 with the new payload and diff against the reviewed text on ml#7 after the batch-apply; report class-signature hit rate (round 1 hit 20/23).
  • Retention checks and the script-ratio band must treat an all-English exercise statement as compliant, not under-translation (same consequence D-2026-08-17 recorded for hints/solutions).

Also in scope

  • Decision record for the codification hold ("do not make ഇത് a rule yet") — QuantEcon/project-translation#44 box 2, still missing from .dev/decisions/.
  • After merge: cut the release so the rules reach production before round 3 (matplotlib) is generated.

Refs: #189, #272, #273, #240, #229, QuantEcon/lecture-python-programming.ml#7, QuantEcon/project-translation#44, QuantEcon/project-translation reports/2026-09-01-ml-functions-review-disposition.md.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementImprovement to existing content or functionality

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions