covtl-sandhi — Inter-word Sandhi for the COVTL Pipeline Languages
A standalone package of inter-word sandhi rules (the word-boundary phonological phenomena that a strictly word-by-word g2p cannot produce) for the six languages of the covtl-pipeline: fr, en, it, es, pt, de. Stdlib only — no pipeline imports, no dependencies.
| language | phenomenon | example | module |
|---|---|---|---|
| fr | latent consonant (liaison) | "faut il" → fo.til, "mon ami" → mO~.na.mi |
sandhi/fr.py |
| en | a→an + onset linking / linking-r | "a apple" → @.na.p@l, "far away" → fa.R@.we |
sandhi/en.py |
| it | raddoppiamento sintattico + euphonic d | "a casa" → a.kka.sa, "e io" → e.di.o |
sandhi/it.py |
| es | enlace + y→e / o→u alternation | "los amigos" → lo.sa.mi.gos, "y Ignacio" → e.i.gna.Tjo |
sandhi/es.py |
| pt | encadeamento + EP voicing | "os amigos" → o.Z@.mi.guS |
sandhi/pt.py |
| de | Glottalversatz (anti-liaison) | "ein Apfel" → ajn a.pf@l |
sandhi/de.py |
The synthesis engine is never touched: the modules live in the text/g2p layer, rewrite only the text or the SAMPA, and compose with the pipeline's expressive prosody patch (the sandhi key is always a consonant — never a nucleus — so the F0 tiers stay aligned; nothing is ever inserted across a pause).
Architecture: Branch A (hook) + Branch B (this package)
covtl-pipeline covtl-sandhi (Branch B)
┌──────────────────────────┐ ┌───────────────────────────┐
│ vtl_synth/utils/sandhi/ │◄─copy─┤ sandhi/ (full rules) │
│ __init__.py (STUB) │ or │ fr en it es pt de + base │
│ SANDHI_FULL = False │ pip │ data/*.txt (views) │
│ → pure identity │ └───────────────────────────┘
│ --sandhi/--sandhi-mode │
└──────────────────────────┘
- Branch A = the git patch
patch/covtl-pipeline-sandhi-hook.patch(shipped in the zip): it adds to the pipeline the foldervtl_synth/utils/sandhi/(a stub:SANDHI_FULL = False, every entry point is the identity) plus the--sandhi/--sandhi-modeoptions. Without Branch B, the pipeline outputs are bit-identical to those of the unpatched repository — the hook is invisible by default (--sandhi off). The hook is also merged into the pipeline'smainbranch (commit82694bc): on a recent clone thegit applystep is unnecessary — the install scripts detect it ("already applied") and skip it; the patch serves older checkouts. It is the pipeline's single cross-word-sandhi dispatch: the historical 5-language liaison pack (v1–v3,liaison_*modules) was never merged tomainand is superseded by this package (rule parity archived: 39/39 identical outputs on the shared battery). - Branch B = this package: the rules. Two ways to activate it:
- direct copy (recommended to stay self-contained) — the stub
folder ALREADY exists, so you copy the CONTENT (note the
/.: without it,cp -r sandhi/ dst/would nest the folder one level too deep):cp -r sandhi/. <pipeline>/vtl_synth/utils/sandhi/
the package overwrites the stub, and the hook findsSANDHI_FULL = True; - pip:
pip install .— the hook detectsimport sandhi(site-packages) if the stub has not been replaced.
- direct copy (recommended to stay self-contained) — the stub
folder ALREADY exists, so you copy the CONTENT (note the
The hook resolves in this order: replaced stub (copy) → pip package →
stub (identity + one warning per run() if --sandhi is requested
without the package).
Installation
# 1) fresh pipeline + hook (Branch A)
git clone https://github.com/FBerthommier/covtl-pipeline.git
cd covtl-pipeline
git apply patch/covtl-pipeline-sandhi-hook.patch
pip install -e . # (same as for the bare repo)
# 2a) activate the rules: copy the package (Branch B)
# (the stub folder already exists — copy the CONTENT, note the "/.")
cp -r sandhi/. vtl_synth/utils/sandhi/
# 2b) …or pip
pip install /path/to/covtl-sandhi-v0.1.0
Quick test (after 2a/2b):
vtl-synth run "faut il" -l fr --sandhi standard --no-video -o out # fo.til
vtl-synth run "a apple" -l en --sandhi standard --no-video -o out # @.na.p@l
vtl-synth run "los amigos" -l es --sandhi standard --no-video -o out # lo.sa.mi.gos
vtl-synth run "os amigos" -l pt --sandhi standard --no-video -o out # o.Z@.mi.guS
vtl-synth run "ein Apfel" -l de --sandhi standard --no-video -o out # ajn a.pf@l
Coverage levels (--sandhi)
The level is a monotone filter over each language's table:
minimal ⊆ standard ⊆ careful. It never changes the phonology of a
rule that fires — only which pair classes are allowed to fire
(see sandhi/base.py).
| level | fr | en | it | es | pt | de |
|---|---|---|---|---|---|---|
minimal |
obligatory liaisons: determiners, pronouns, copulas/auxiliaries | a→an | euphonic d + monosyllabic RS triggers | y→e, o→u alternations | encadeamento after function words | Glottalversatz after article/determiner |
standard (API default) |
+ everyday class: adverbs, prepositions, negation, preposed adjectives, modals | + onset linking / linking-r | + full RS: oxytones, come/dove/qualche | + enlace | + encadeamento everywhere (voicing included) | + before any lexical word with vowel onset |
careful |
+ formal register: liaison after plural noun/adjective (documented -s/-x heuristic) | = standard | = standard | = standard | = standard | + before function words too (hyperarticulation) |
The "= standard" cells are assumed and documented: where the
language has no reliable register-dependent rule, careful equals
standard — never a silent difference.
Defaults: CLI --sandhi off (bit-identical), Python API
level='standard'. The historical liaison_* functions (v1–v3)
called without a level reproduce exactly the behavior of the
5-language patch.
The three modes (--sandhi-mode) — the historical implementations, optional
| mode | principle | default |
|---|---|---|
g2p |
sandhi-aware gateway: per-word oracle + SAMPA fusion with corrected tokens (recommended, most faithful) | ✔ |
post |
pure SAMPA post-processor: the base g2p stays totally untouched | |
pre |
orthographic rewrite BEFORE the g2p (most decoupled, least faithful — documented no-op for de/en) |
Python API
from sandhi import (SANDHI_LEVELS, sandhi_supported, apply_sandhi,
apply_sandhi_text, sandhi_rewrite_text,
apply_sandhi_sampa, sandhi_oracle, join_words_keys)
sandhi_supported('fr') # True (fr/en/it/es/pt/de)
# gateway over a text (the monotone path — the hook's entry point)
sampa = apply_sandhi_text('fr', 'faut il', g2p, level='standard',
mode='g2p') # 'fo.til'
# low level: per-word keys, AFTER the per-word g2p (fusion into slots)
keys = apply_sandhi('es', ['los', 'amigos'], ['los', 'a.mi.gos'],
'standard') # ['lo', 'sa.mi.gos']
phrase = join_words_keys(keys) # 'lo.sa.mi.gos' (sep='.')
# expressive path: fusion into an already-planned SAMPA ('%' markers
# present) — never across a pause
sampa2 = apply_sandhi_sampa('fr', 'mon ami', planned_sampa, g2p,
level='standard', mode='g2p')
# pre mode alone: the rewritten spelling (to feed the planner)
text2 = sandhi_rewrite_text('en', 'a apple', g2p, 'minimal') # 'an apple'
Each language module additionally exposes the full historical API
(plan_pairs, liaison_oracle, apply_liaison_pre,
apply_liaison_post, liaison_g2p — v3 signatures + optional
level) and the covtl-sandhi aliases (decide_pair, sandhi_g2p,
apply_sandhi_pre, apply_sandhi_post, sandhi_oracle).
Editable tables (sandhi/data/)
Each file is an editable view over one table: one entry per line,
lowercase, # comments. If it exists and is non-empty, it replaces the
embedded table; otherwise the default value applies (the package always
stays importable — these files are not a dependency).
data/fr_h_aspire.txt aspirated-h words blocking liaison (fr)
data/it_rs_triggers.txt function-word triggers of raddoppiamento (it)
data/pt_function_words.txt function words: minimal encadeamento (pt)
data/de_glottal_exempt.txt function words exempt from the glottal boundary (de)
A word ADDED to it_rs_triggers.txt is level standard; the minimal
subclasses are embedded in the modules (see their docstrings).
Tests
pip install pytest
python -m pytest tests/ -q
The suite is standalone (embedded g2p stubs, no pipeline needed):
monotone levels per language, the three modes, invariants (off =
identity, no modification without a pair, never across a pause),
package API, data files, decide_pair on all six languages.
Known limitations (documented in each module)
premode: partial coverage — fr: no correct fallback spelling for "est", "petit", "plus", "vieux"…; de/en: the glottal stop and onset linking have NO spelling (no-op with a warning, use g2p/post);- sinalefa (es) / smoothing (en): out of scope — vowel fusion would delete a syllabic nucleus and misalign the F0 tiers of the prosody patch;
- fr
careful: since the noun/verb boundary is not marked in writing, liaison after a plural is a closed heuristic (-s/-x, excluding verbal endings -es/-ent/-ez/-ons); - the
enmodule follows the pipeline's CMUdict gateway conventions (British r already present in the token:far→faR).
License
GPL-3.0-or-later — see LICENSE (the upstream pipeline is GPL-3.0;
this package derives from it and remains compatible).
Metadata
Release files for covtl-sandhi 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| covtl_sandhi-0.1.1.tar.gz | 79.9 kB | Without provenance | Details for covtl_sandhi-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| covtl_sandhi-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for covtl_sandhi-0.1.1-py3-none-any.whl |
Total release size: 171.0 kB
Release files / covtl_sandhi-0.1.1.tar.gz
| Download URL | covtl_sandhi-0.1.1.tar.gz |
|---|---|
| Size | 79.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6c007e5daec4f596a8bc7a84d5d82bf8a9a1ada3283af6e503357b7583bb1427
|
|
BLAKE2b-256 checksum How to use checksums |
a5e6d60a92d6274104dc29e7973f23c7e673f5ac47fa28f0a87aeb8638e3fa66
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Release files / covtl_sandhi-0.1.1-py3-none-any.whl
| Download URL | covtl_sandhi-0.1.1-py3-none-any.whl |
|---|---|
| Size | 91.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
07a5c151ecef18a65618701262a7bd45c8505070b78932818edbfee29c4427cb
|
|
BLAKE2b-256 checksum How to use checksums |
f9929952a517b549af02698d5700102e82f6c3f8d8db0800089a63771a84afeb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Security for covtl-sandhi 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.