Skip to content

feat: X-SAMPA / Praat / SIL / Branner → IPA phonetic-alphabet modifiers#2

Merged
willwade merged 1 commit into
masterfrom
feature/ipaconvert
Jun 25, 2026
Merged

feat: X-SAMPA / Praat / SIL / Branner → IPA phonetic-alphabet modifiers#2
willwade merged 1 commit into
masterfrom
feature/ipaconvert

Conversation

@willwade

Copy link
Copy Markdown
Contributor

Summary

Adds four new SpeechMarkdown text-modifier keys — xsampa, praat, sil, branner — that translate to Unicode IPA via the ipa-translate crate and emit the same <phoneme alphabet=\"ipa\" ph=\"…\">text</phoneme> shape as the existing ipa: modifier. Sits behind a default-on phonetic-translation Cargo feature so downstream consumers can opt out of the extra dependency.

(pecan)[xsampa:\"'pi.k{n\"]
  → <phoneme alphabet=\"ipa\" ph=\"ʲpi.kæn\">pecan</phoneme>

(hello)[xsampa:\"h@\"loU\"]
  → <phoneme alphabet=\"ipa\" ph=\"həˈloʊ\">hello</phoneme>
  • Google strips the phoneme tag (mirrors existing ipa: behaviour); Alexa and Azure emit it.
  • Conversion is infallible per upstream — invalid source produces garbage IPA, matching how ipa: passes its value through unvalidated today.
  • Integration test gates the new fixtures on the feature flag so both feature configurations stay green.
  • Fixtures live in the submodule on willwade/speechmarkdown-test-files@feat/expand-test-fixtures (six new directories: xsampa-standard, xsampa-stress, praat-standard, sil-standard, branner-standard, combo-xsampa-emphasis).

Test plan

  • `cargo test` (default features) — should pass including the new `phonetic_alphabet_tests` module and the six new integration fixtures
  • `cargo test --no-default-features` — should pass; the six feature-gated fixtures are skipped
  • `cargo clippy --all-targets` clean
  • Verify downstream (`swift-tts-wrapper` etc.) still builds against the new SpeechMarkdownRust binary with the default feature on

Adds four new text-modifier keys — xsampa, praat, sil, branner — that
translate to Unicode IPA via the ipa-translate crate and emit the same
<phoneme alphabet="ipa" ph="…">text</phoneme> shape as the existing ipa:
modifier. Sits behind a default-on `phonetic-translation` feature so
downstream consumers can opt out of the extra dependency.

Example:
  (pecan)[xsampa:"'pi.k{n"]
  → <phoneme alphabet="ipa" ph="ʲpi.kæn">pecan</phoneme>

  (hello)[xsampa:"h@"loU"]
  → <phoneme alphabet="ipa" ph="həˈloʊ">hello</phoneme>

Google strips the phoneme tag (mirrors existing ipa: behaviour); Alexa
and Azure emit it. Conversion is infallible per upstream — invalid
source produces garbage IPA, matching how ipa: passes its value through
unvalidated today.

Integration test skips the new fixtures when the feature is off so
both feature configurations stay green. Submodule pointer bumped to
the matching commit on willwade/speechmarkdown-test-files@feat/expand-test-fixtures.
@willwade willwade merged commit dfba348 into master Jun 25, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant