Status: Current
Last updated: 2026-05-21 13:20 EDT
This document catalogs every language-specific workaround in batchalign3’s
morphosyntax pipeline (morphotag) and related commands. Each entry describes
what the workaround does, why it exists, whether the underlying issue is
likely to persist, and how to verify it is still needed.
The morphosyntax pipeline relies on Stanza for UD annotation. Stanza’s models
have known per-language quirks: mislabeled POS tags, missing features, incorrect
MWT expansion. These workarounds correct systematic errors to produce accurate
CHAT %mor/%gra output.
These entries mix three kinds of behavior:
CHAT/CHILDES conventions that should remain even if upstream models improve
Stanza-specific workarounds that may become removable after verification
architectural requirements such as code mapping or Cantonese FA romanization
All workarounds were ported from batchalign2 and now live entirely in Rust
(crates/batchalign-transform/src/morphosyntax/lang_*.rs). Python workers only
call Stanza and return raw output, all workaround logic is applied
server-side.
Irregular-form entries (see the file for the active list)
What
Static lookup of irregular past tense / participle forms (be→was/been, go→went/gone, etc.). Used by verb_features() to emit -PAST or -PASTP suffixes.
Why
Stanza’s lemmatizer doesn’t reliably map inflected forms back to base forms for irregular verbs. The lookup confirms whether a surface form is indeed a known irregular conjugation of its lemma.
Origin
Ported from batchalign2/pipelines/morphosyntax/en/irr.py
Still needed?
Yes, permanent. This is a CHAT convention: %mor must show -PAST/-PASTP suffixes on irregular verbs. Even if Stanza improved, the lookup table is needed to classify forms.
Tokens with apostrophes (don’t, can’t, ’ve, ’ll, etc.) are marked as (text, true) MWT hints for Stanza expansion. Exception: “o’clock” and “o’er” (prefix “o” before apostrophe).
Why
Stanza’s neural tokenizer sometimes fails to split contractions. Explicit MWT hints ensure consistent expansion.
Origin
batchalign2/ud.py:680-685
Still needed?
Likely yes. English contractions remain a tokenization edge case. Removing this would require testing every contraction form with current Stanza.
English uses Stanza’s “gum” MWT package instead of default.
Why
The GUM corpus MWT model provides better English contraction handling.
Origin
batchalign2 Stanza configuration
Still needed?
Unknown, testable. Newer Stanza versions may have improved the default package. Test: run English morphotag with and without “gum” package, compare results on contraction-heavy input.
Pronoun-case lookup (Nominative + Accusative entries; see the file)
What
Hardcoded table mapping French pronouns to case (Nom/Acc) by surface form. Applied when UD word has POS=PRON. Handles apostrophes (e.g., “qu’” → check “qu”).
Why
Stanza’s French model often omits or misassigns the Case feature on pronouns. The lookup provides correct case for CHAT %mor output.
Origin
batchalign2/pipelines/morphosyntax/fr/case.py
Still needed?
Likely yes. Case assignment is a known weak point of UD French models. Even if Stanza improves, the lookup table is a CHAT-specific convention ensuring consistent output.
List of French nouns that undergo auditory plural marking (e.g., “cheval”/“chevaux”). Used by noun_features() to correctly emit plural suffixes in %mor.
Why
Stanza may not distinguish between regular and APM plurals. CHILDES/CHAT convention requires explicit plural marking for these nouns.
Origin
batchalign2/pipelines/morphosyntax/fr/apmn.py
Still needed?
Yes, permanent. This is a CHAT/CHILDES convention for French child language analysis. The list defines which nouns get special plural treatment regardless of Stanza’s output.
Three explicit patches plus elision/multi-clitic logic:
“aujourd’hui” → plain text (prevent MWT expansion)
“au” → force MWT (à + le contraction)
Elision prefixes (jusqu’, puisqu’, quelqu’, aujourd’) → split on apostrophe
Multi-clitic (e.g., “d’l’attraper”) → split into individual clitics
Why
Stanza’s French MWT model has known quirks with these forms.
Origin
batchalign2/ud.py:671-689
Still needed?
Likely yes for aujourd’hui and elision rules. These are French orthographic conventions, not Stanza bugs. The “au” forcing could be tested with current Stanza, it may handle it correctly now.
Tests
French-specific tests embedded in tokenizer_realign.rs
Stanza’s Japanese models systematically mislabel auxiliary particles and verbs. The surface form is a reliable signal for the true grammatical function.
Almost certainly yes. Japanese auxiliary verb classification is a known challenge for UD models. These are systematic patterns, not isolated bugs. Each rule should be verified individually against current Stanza output, but the overall framework will likely remain necessary.
Order matters
The if/elif chain is order-dependent, matches Python exactly.
Tests
lang_ja.rs: 4 tests covering sconj, intj, de, and no-override cases
These workarounds address specific Stanza model bugs that may have been fixed.
Each should be tested by running the trigger input through current Stanza
without the workaround:
ID
Workaround
Test Method
E3
English GUM MWT package
Compare default vs GUM package on contractions
F3
French “au” MWT forcing
Check if Stanza recognizes “au” as contraction
I1
Italian “l’” suppression
Check if Stanza still over-expands “l’”
I2
Italian “lei” merge
Check if Stanza still splits “lei” → “le” + “i”
P1
Portuguese “d’água”
Check if Stanza recognizes as contraction
J1
Japanese verb form overrides
Test the current rule set against a curated trigger corpus
To systematically determine which workarounds are still needed, create a test
fixture that:
Loads a Stanza pipeline for each language
Runs a curated input through Stanza without workarounds
Runs the same input with workarounds
Asserts they differ (proving the workaround is still needed)
These tests should be golden model tests (skipped when models are
unavailable) and re-run whenever Stanza is upgraded. If a test passes
(outputs agree), the workaround can be investigated for retirement.
Example test structure:
#![allow(unused)]
fn main() {
#[test]
#[ignore] // Requires Stanza models
fn verify_italian_lei_split_still_needed() {
// 1. Run "lei" through Italian Stanza without lei-merge workaround
// 2. Check if Stanza splits it into "le" + "i"
// 3. If it does: workaround still needed
// 4. If it doesn't: mark for retirement
}
}
These tests should be added under crates/batchalign/tests/ (e.g., the
ml_golden test binary) since they require real Stanza inference.
This page last changed: 2026-07-29 (commit f4f12680). The whole book last changed: 2026-09-16 (commit 34d249d8).