Skip to content

docs: fix Rime PRONOUNCE example and add bulk pronunciation lexicon guidance (T-3868) - #1245

Draft
jamsea wants to merge 2 commits into
mainfrom
docs/t-3868-pronunciation-lexicons
Draft

docs: fix Rime PRONOUNCE example and add bulk pronunciation lexicon guidance (T-3868)#1245
jamsea wants to merge 2 commits into
mainfrom
docs/t-3868-pronunciation-lexicons

Conversation

@jamsea

@jamsea jamsea commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Two documentation gaps found while working support ticket

All claims below were verified against pipecat main at 0417f251.

Gap A: the Rime PRONOUNCE example cannot run

The page showed RimeTTSService.PRONOUNCE(text, "potato", "potato"), called on the class with 3 arguments. PRONOUNCE is an instance method taking (self, text, word, phoneme). The @staticmethod decorator above it binds PAUSE_TAG, not PRONOUNCE. As documented, the call binds self=text and leaves phoneme missing, so it raises TypeError.

INLINE_SPEED is an instance method too, and its example on the same page had the identical problem. Fixed both.

Also added:

  • A note that PRONOUNCE takes three arguments, so it needs a small wrapper function to satisfy the (text, aggregation_type) text transform contract.
  • A note that PRONOUNCE enables bracket phonemization for the next message only, with a pointer to the Settings field that keeps it on for the whole session. That is the better choice for anything beyond a one-off.

Gap B: no guidance on bulk pronunciation lexicons

Nothing in the docs told you how to do a lexicon of hundreds of words, or which providers can host one. New "Bulk pronunciation overrides" section in the Text-to-Speech guide covering:

  1. replace_text as the portable client side path. Rules are regexes compiled once at construction and applied as a loop per chunk, so cost grows linearly and stays small. Measured roughly 0.4 ms per sentence at 300 rules and 1.4 ms at 1000 on an Apple silicon Mac. Presented as an order of magnitude, with hardware variance called out.

  2. The footgun: transforms run after aggregation. In TextAggregationMode.TOKEN, SimpleTextAggregator yields each text immediately with no buffering, so a pattern spanning multiple words can never match. Multi-word lexicon entries require sentence aggregation. This is the single most useful thing on the page. Related: Token-mode text transforms cannot match across token boundaries — bounded lookback (LiveKit-style) instead of full sentence aggregation pipecat#5574.

  3. Provider hosted lexicon table, checked by grepping every src/pipecat/services/*/tts.py:

    • AWS Polly: lexicon_names
    • NVIDIA: custom_dictionary, with a warning that entries are joined into one comma separated string with no escaping, so a comma in an entry corrupts the dictionary
    • Cartesia: pronunciation_dict_id
    • ElevenLabs: pronunciation_dictionary_locators, deprecated in 1.6.0 and removed in 2.0.0
    • Azure: not possible. _construct_ssml escapes the input text before assembling SSML, so an injected <phoneme> tag is escaped and spoken literally, and there is no opt-out. Worth stating, since the page lists "SSML support: Fine-grained pronunciation control" as an advanced feature and people try it on Azure.
  4. ElevenLabs specifics: prefer respellings over IPA, since respellings work on every model while IPA <phoneme> tags need enable_ssml_parsing=True and only work on v2 models.

Checks run

  • npx mint broken-links --check-anchors --check-redirects: no broken links
  • node scripts/check-imports.mjs --pipecat ../pipecat: all imports resolve
  • node scripts/docs-meta-lint.mjs: the one error and the llms.txt budget warning both reproduce on main unchanged, so neither comes from this branch
  • llms.txt and llms-full.txt regenerated

Note: npm run format is not a no-op on main right now, it reformats about 30 unrelated files. I reverted those so this diff stays scoped.

Opened as a draft for review.

Two documentation gaps found while working support ticket T-3868 (a
customer needing 300 to 1000 medication pronunciation overrides).

Rime TTS page:

- PRONOUNCE and INLINE_SPEED are instance methods, but both examples
  called them on the class. As written they raise a TypeError. Both now
  call the method on the service instance.
- Note that PRONOUNCE takes three arguments, so it needs a small wrapper
  function to be used as a text transform.
- Note that PRONOUNCE only turns on bracket phonemization for the next
  message, and point to the Settings field that keeps it on for the whole
  session.
- Link to the new bulk lexicon section for large pronunciation lists.

Text-to-Speech guide, new "Bulk pronunciation overrides" section:

- replace_text as the portable client side path, with a rough sense of
  its cost as the rule count grows.
- Warn that text transforms run after aggregation, so multi-word
  replacements cannot match in TOKEN mode and need sentence aggregation.
- Table of provider hosted lexicon options (AWS Polly, NVIDIA, Cartesia,
  ElevenLabs, Azure).
- Warn that NVIDIA custom_dictionary entries cannot contain commas.
- Note that Azure has no lexicon path, since it escapes text before
  building SSML, so an injected phoneme tag is read out literally.
- Recommend respellings over IPA on ElevenLabs, since respellings work on
  every model.

Regenerated llms.txt and llms-full.txt.
@jamsea jamsea added the pipecat label Sep 4, 2026
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

🔍 Mintlify preview for this branch: https://daily-docs-t-3868-pronunciation-lexicons.mintlify.site

@markbackman

Copy link
Copy Markdown
Contributor

This seems like guide information, not in the learn section, as it's not required for all cases.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants