Skip to content

Use English word boundaries for translated speech - #1732

Open
Afloat16 wants to merge 1 commit into
SYSTRAN:masterfrom
Afloat16:fix/english-translation-word-boundaries-20261126
Open

Afloat16 wants to merge 1 commit into
SYSTRAN:masterfrom
Afloat16:fix/english-translation-word-boundaries-20261126

Conversation

@Afloat16

Copy link
Copy Markdown

Problem

Word alignment chooses its token-grouping rules from the source language even when task="translate" produces English. For Chinese, Japanese, Thai, Lao, Burmese and Cantonese sources, this splits English words at BPE token boundaries instead of word boundaries.

For example, using the repository's hotwords.mp3 fixture with task="translate", language="ja" and hotwords="ComfyUI", both transcription pipelines produce the English text ComfyUI but expose three separate Word entries: Com, fy and UI.

Change

Use English word-boundary rules when grouping translation tokens. Keep the source language and task tokens in the decoder prompt unchanged, and retain the existing Unicode splitting rules for transcription in languages without spaces.

Validation

  • Complete repository suite: pytest -q tests/ — 29 passed, including actual tiny/tiny.en/base model inference and downloader tests.
  • The ten new cases produce 7 failed, 3 passed on the unchanged base; all ten pass after the fix. They cover five affected source languages, English and French translation controls, unchanged Chinese transcription, and real tiny-model word alignment through both the sequential and batched public APIs.
  • Both real inference regressions now return ComfyUI as one word. The tests also check that token grouping preserves every input token and leaves source-language prompt metadata intact.
  • Repository-wide Black, isort and Flake8 checks and git diff --check pass.

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