Skip to content

caption word chunking and text assembly duplicated across four places #3274

Closed

Description

@Openroot-MI

The caption word utilities (caption_text_from_words, the attach-to-previous helpers, normalize_caption_words, caption_word_chunks, and the segment size constants) are copy-pasted in four places and they've already drifted.

  • crates/project/src/caption_timing.rs (private copy of the attach helpers + caption_text_from_words)
  • apps/desktop/src-tauri/src/captions.rs (full set: attach helpers, normalize, chunk, text assembly, TARGET_CAPTION_WORDS_PER_SEGMENT etc.)
  • apps/desktop-gpui/src/transcription.rs (same full set again)
  • apps/desktop-gpui/src/editor_window.rs (another caption_text_from_words with the attach list inlined)

Concrete drift: the weak-word boundary check in captions.rs uses normalized.len() <= 1 (bytes) while transcription.rs uses normalized.chars().count() <= 1. So the unicode fix from #2685 only landed in the gpui backend, a one letter word like "à" still counts as two letters on the Tauri side.

I'd move the whole set into cap-project next to CaptionWord and have everything consume it from there. Happy to send that PR, and there's a second one I'd build on top of it (configurable words per caption, issue coming).

richie said on discord he's fine with PRs for this area.

Activity

  1. linear commented on Oct 25, 2026

    @linear
  2. Ker102 commented on Oct 25, 2026

    @Ker102
    Contributor

    moved this over to #3290, it went up from the wrong account. sorry for the noise.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions