Compare commits

..

3 commits

Author SHA1 Message Date
CRT
7a64011810 Textream for Windows is now CRTkafa's and Emrah's: joint credits, 1.3.0
Emrah's Turkish speech recognition (seda-v0.1, the Turkish-aware case
fold in the matcher) comes in as his own two commits. The README, the
licence, the installer's copyright and the crate authors now name both,
with links to his X profile and to the repository where his work was
first published.

The release scan takes its command from WAYBETTER_RELEASE_CHECK, since
the public CLI no longer carries the scanner, and a dispatch-only
workflow builds the same path-free installer on a Windows runner.
2026-10-20 03:59:01 +07:00
Emrah
4092f91318 Credit the Windows port and the Turkish support in the README
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 23:17:50 +03:00
Emrah
7170a7d96c Add Turkish speech recognition with seda-v0.1
Turkish now has a streaming model in the registry: atasoglu/seda-v0.1, a
Zipformer2 transducer trained on Common Voice and the ISSAI Turkish Speech
Corpus (Apache-2.0, ~73 MB, int8 encoder and joiner). The four file hashes
were pinned from bytes downloaded and hashed locally, not copied from the
Hub listing.

The model writes lowercase spoken-form Turkish, and Unicode's default
lowercase gets Turkish wrong both ways: `I` becomes `i` where the model
writes `ı`, and `İ` becomes `i` plus a combining dot no transcript
contains. A capitalised script line ("IŞIK", "İSTANBUL") could therefore
never match. The matcher now compares through `fold_case`, which folds
I, İ, i and ı to one `i` without needing to know the script's language,
still per grapheme so offsets cannot shift.

The real-model smoke test takes TEXTREAM_TEST_MODEL_ID so it can load any
registry entry, not only the default English one. Run against seda with
Windows' Turkish TTS voice, the transcript came back word for word and
the matcher reached the end of the script.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 22:40:13 +03:00
12 changed files with 170 additions and 40 deletions

View file

@ -0,0 +1,33 @@
# The release installer, built path-free on a Windows runner. Run by hand only; the artifact is
# scanned with the private term list before it is attached to a release, never from here.
name: release
on:
workflow_dispatch:
inputs:
ref:
description: Commit or tag to build
required: true
default: master
jobs:
windows:
runs-on: windows
timeout-minutes: 90
defaults:
run:
# Git Bash by its path: the runner service's PATH need not hold it.
shell: '"C:\\Program Files\\Git\\bin\\bash.exe" --noprofile --norc -eo pipefail {0}'
steps:
- uses: https://code.forgejo.org/actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- name: Build the installer, path-free
run: |
bun install
bunx waybetter@0.7.0 build-env --root "$PWD" -- bun run app:build
ls -l target/release/bundle/nsis/
- uses: https://code.forgejo.org/actions/upload-artifact@v3
with:
name: installer
if-no-files-found: error
path: target/release/bundle/nsis/*-setup.exe

4
Cargo.lock generated
View file

@ -3111,7 +3111,7 @@ dependencies = [
[[package]]
name = "prompt-core"
version = "1.2.0"
version = "1.3.0"
dependencies = [
"unicode-segmentation",
]
@ -4396,7 +4396,7 @@ dependencies = [
[[package]]
name = "textream"
version = "1.2.0"
version = "1.3.0"
dependencies = [
"cpal",
"prompt-core",

View file

@ -3,11 +3,11 @@ members = ["crates/prompt-core", "src-tauri"]
resolver = "2"
[workspace.package]
version = "1.2.0"
version = "1.3.0"
edition = "2021"
rust-version = "1.80"
license = "MIT"
authors = ["CRTkafa"]
authors = ["CRTkafa", "Emrah"]
[workspace.dependencies]
unicode-segmentation = "1.12"

View file

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2026 CRTkafa
Copyright (c) 2026 CRTkafa and Emrah
Portions of the script-alignment, cue-handling and voice-activity logic are
reimplementations of algorithms from Textream (https://github.com/f/textream),

View file

@ -14,13 +14,20 @@
<p align="center">
The Windows port of <a href="https://github.com/f/textream"><strong>Textream</strong></a>
by <a href="https://fka.dev">Fatih Kadir Akın</a>
by <a href="https://fka.dev">Fatih Kadir Akın</a>,
made by <a href="https://x.com/CRTkafa">CRTkafa</a> and <a href="https://x.com/vebaban_">Emrah</a>
</p>
> 🇹🇷 **Türkçe:** Textream for Windows, [Fatih Kadir Akın](https://github.com/f)'ın
> macOS uygulaması [Textream](https://github.com/f/textream)'in Windows sürümüdür.
> Windows portunu [CRTkafa](https://x.com/CRTkafa), Türkçe konuşma tanımayı
> [Emrah](https://x.com/vebaban_) yaptı; proje artık ikisinin. Sesli takip
> (Word Tracking) modunda Türkçe metinler kelime kelime izlenir.
---
> **v1.0.** All three guidance modes work end to end. Speech recognition
> covers several languages but not Turkish yet — see
> **v1.3.** All three guidance modes work end to end. Speech recognition
> covers several languages, Turkish included — see
> [Languages](#languages).
<p align="center">
@ -171,13 +178,15 @@ exactly when somebody has published a streaming model for it:
| English (small) — fastest, the default | 42 MB |
| English, German, French | 71 MB each |
| Spanish | 156 MB |
| Turkish | 73 MB |
| Chinese (Mandarin) | 77 MB |
| Arabic, Indonesian, Japanese, Russian, Thai, Vietnamese (one model) | 339 MB |
**Turkish is not available yet.** A model exists — Kroko publishes a Turkish
community streaming model — but only in their own packaging, and nobody has
converted it to the ONNX layout sherpa-onnx loads. That conversion is the whole
job; the app already handles everything after it.
Turkish uses [seda-v0.1](https://huggingface.co/atasoglu/seda-v0.1), a
streaming Zipformer2 transducer trained on Common Voice and the ISSAI Turkish
Speech Corpus (Apache-2.0). Its transcripts are lowercase, so the matcher folds
`I`, `İ`, `i` and `ı` together — Unicode's default lowercase gets Turkish wrong,
and a capitalised script line would otherwise never match what was said.
Adding a language is a few lines in [`model.rs`](src-tauri/src/model.rs) and a
published model to point at.
@ -251,6 +260,12 @@ name listed in the file `WAYBETTER_FORBIDDEN_TERMS` points at, is still in it.
Reviewed false positives live in `privacy-allowlist.txt`. It needs CMake and
7-Zip, and only an installer that passed is published.
`WAYBETTER_RELEASE_CHECK` names the scanner command when it is not the CLI's
own `privacy-scan`. Without a Windows machine, the `release` workflow in
[`.forgejo/workflows/release.yml`](.forgejo/workflows/release.yml) builds the
same path-free installer on a Windows runner; it is scanned before it is
attached to a release.
Run the test suite:
```bash
@ -266,7 +281,7 @@ cargo test --workspace
- [x] Classic and Voice-Activated modes end to end
- [x] On-device streaming speech recognition — Word Tracking works
- [x] A model registry covering several languages
- [ ] Turkish, once a streaming model is converted for it
- [x] Turkish
- [x] Settings that persist across launches
- [x] Font, size, colour and opacity
- [x] Pause, hold, and mute from the transport dock
@ -300,11 +315,18 @@ icon with his blessing. The cue syntax, the three guidance modes, and the
approach to word tracking are all his design.
- Original macOS app: [github.com/f/textream](https://github.com/f/textream)
- Windows port: [CRT](https://git.crt.fyi/CRT)
- Textream for Windows: [CRTkafa](https://x.com/CRTkafa) and
[Emrah](https://x.com/vebaban_), at
[git.crt.fyi/CRT/textream-windows](https://git.crt.fyi/CRT/textream-windows)
- Windows port: [CRTkafa](https://x.com/CRTkafa)
- Turkish speech recognition: [Emrah](https://x.com/vebaban_) — first
published in his repository,
[github.com/veysiemrah/textream-windows](https://github.com/veysiemrah/textream-windows)
Speech recognition uses [sherpa-onnx](https://github.com/k2-fsa/sherpa-onnx) by
the k2-fsa team, with streaming models published by
[csukuangfj](https://huggingface.co/csukuangfj).
[csukuangfj](https://huggingface.co/csukuangfj) and, for Turkish,
[atasoglu](https://huggingface.co/atasoglu).
The dyslexia-friendly typeface is
[OpenDyslexic](https://opendyslexic.org) by Abbie Gonzalez, bundled under the

View file

@ -21,7 +21,7 @@ use crate::alignment::{
DEFAULT_AGREEMENT_TOLERANCE,
};
use crate::script::PromptScript;
use crate::text::{graphemes, is_readable, split_into_words};
use crate::text::{fold_case, graphemes, is_readable, split_into_words};
/// How far the matcher may look ahead on either side when it hits a mismatch.
const MAX_SKIP: usize = 5;
@ -54,15 +54,10 @@ impl PromptMatcher {
source.annotation_ranges(),
offset.min(source.character_count()),
);
// Lowercasing per grapheme rather than over the whole string keeps a
// 1:1 index mapping. A whole-string lowercase can change the grapheme
// count (Turkish `İ` expands to two scalars) and silently shift every
// offset the matcher returns.
let lowered = source
.graphemes()
.iter()
.map(|g| g.to_lowercase())
.collect();
// Folding per grapheme rather than over the whole string keeps a 1:1
// index mapping, so no case change can shift the offsets the matcher
// returns.
let lowered = source.graphemes().iter().map(|g| fold_case(g)).collect();
Self {
source,
@ -174,7 +169,7 @@ impl PromptMatcher {
/// transcript reaches.
fn character_level_match(&self, spoken: &str) -> usize {
let source = &self.lowered[self.match_start_offset..];
let spoken: Vec<String> = graphemes(&spoken.to_lowercase())
let spoken: Vec<String> = graphemes(&fold_case(spoken))
.into_iter()
.filter(|g| is_readable(g) || g.chars().all(char::is_whitespace))
.collect();
@ -257,7 +252,7 @@ impl PromptMatcher {
.source
.slice(self.match_start_offset..self.source.character_count());
let source_words: Vec<&str> = remaining.split(' ').filter(|w| !w.is_empty()).collect();
let spoken_words = split_into_words(&spoken.to_lowercase());
let spoken_words = split_into_words(&fold_case(spoken));
let mut source_index = 0usize;
let mut spoken_index = 0usize;
@ -265,9 +260,9 @@ impl PromptMatcher {
let mut inside_annotation = false;
let alnum = |word: &str| -> String {
word.chars()
fold_case(word)
.chars()
.filter(|c| c.is_alphanumeric())
.flat_map(char::to_lowercase)
.collect()
};
let width = |word: &str| graphemes(word).len();
@ -594,6 +589,22 @@ mod tests {
assert!(m.recognized_character_count() > 0);
}
#[test]
fn turkish_capitals_match_a_lowercase_transcript() {
// The Turkish model writes lowercase spoken form, so `I` must meet
// `ı` and `İ` must meet `i`.
let mut m = matcher("IŞIK SÖNDÜ İSTANBUL'DA");
m.match_transcript("ışık söndü istanbulda");
assert_eq!(m.recognized_character_count(), m.source().character_count());
}
#[test]
fn a_dotted_capital_does_not_shift_offsets() {
let mut m = matcher("İzmir güzel bir şehir");
m.match_transcript("izmir güzel");
assert_eq!(m.source().slice(0..m.recognized_character_count()).trim_end(), "İzmir güzel");
}
#[test]
fn word_progress_follows_the_highlight() {
let mut m = matcher("alpha beta gamma");

View file

@ -118,6 +118,27 @@ pub fn infer_direction(text: &str) -> TextDirection {
TextDirection::LeftToRight
}
/// Lowercases `text` for comparison, folding the four Turkish i's together.
///
/// Unicode's default lowercase is wrong for Turkish in both directions: `I`
/// becomes `i` where a Turkish recogniser writes `ı`, and `İ` becomes `i` plus
/// a combining dot that no transcript ever contains. So a script line such as
/// "IŞIK" or "İSTANBUL" would never match what was said. Folding `I`, `İ`, `i`
/// and `ı` to one `i` fixes Turkish without needing to know the language, and
/// costs the matcher nothing elsewhere — it is fuzzy about single letters
/// anyway, and no other language contrasts dotted with dotless i.
pub fn fold_case(text: &str) -> String {
let mut folded = String::with_capacity(text.len());
for c in text.chars().flat_map(char::to_lowercase) {
match c {
'ı' => folded.push('i'),
'\u{0307}' if folded.ends_with('i') => {}
other => folded.push(other),
}
}
folded
}
/// Splits `text` into owned grapheme clusters — the unit every offset in this
/// crate is measured in.
pub fn graphemes(text: &str) -> Vec<String> {
@ -188,6 +209,27 @@ mod tests {
assert_eq!(graphemes("a👍🏽b").len(), 3);
}
#[test]
fn fold_case_unifies_the_turkish_i() {
assert_eq!(fold_case("IŞIK"), fold_case("ışık"));
assert_eq!(fold_case("İSTANBUL"), "istanbul");
assert_eq!(fold_case("I\u{0307}stanbul"), "istanbul");
assert_eq!(fold_case("Iğdır"), "iğdir");
}
#[test]
fn fold_case_keeps_one_grapheme_per_grapheme() {
for g in ["İ", "I", "ı", "Ş", "Ğ", "Ö", "Ü", "Ç"] {
assert_eq!(graphemes(&fold_case(g)).len(), 1, "{g}");
}
}
#[test]
fn fold_case_leaves_other_combining_dots_alone() {
// U+0307 after a letter other than i is real content and must survive.
assert_eq!(fold_case("a\u{0307}"), "a\u{0307}");
}
#[test]
fn readability_ignores_punctuation_and_emoji() {
assert!(is_readable("word"));

View file

@ -1,7 +1,7 @@
{
"name": "textream-windows",
"private": true,
"version": "1.2.0",
"version": "1.3.0",
"type": "module",
"scripts": {
"dev": "vite",

View file

@ -16,6 +16,8 @@ const root = dirname(dirname(fileURLToPath(import.meta.url)));
const { version } = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8'));
const installer = join(root, 'target', 'release', 'bundle', 'nsis', `Textream_${version}_x64-setup.exe`);
const waybetter = process.env.WAYBETTER_CLI ? ['node', process.env.WAYBETTER_CLI] : ['waybetter'];
// The scanner is no longer part of the public CLI: WAYBETTER_RELEASE_CHECK names the command that runs it.
const scanner = process.env.WAYBETTER_RELEASE_CHECK ? process.env.WAYBETTER_RELEASE_CHECK.split(' ') : [...waybetter, 'privacy-scan'];
function run(step, [command, ...args]) {
console.log(`\n== ${step}`);
@ -35,5 +37,5 @@ if (!existsSync(installer)) {
console.error(`release: the build left no ${installer}`);
process.exit(1);
}
run('scan the installer', [...waybetter, 'privacy-scan', installer, '--allow', join(root, 'privacy-allowlist.txt')]);
run('scan the installer', [...scanner, installer, '--allow', join(root, 'privacy-allowlist.txt')]);
console.log(`\nClean. Publishable: ${installer}`);

View file

@ -132,6 +132,25 @@ pub const MODELS: &[SpeechModel] = &[
},
download_bytes: 156_200_000,
},
SpeechModel {
id: "tr",
label: "Turkish",
language: "tr",
repo: "atasoglu/seda-v0.1",
files: ModelFiles {
encoder: "encoder.int8.onnx",
decoder: "decoder.onnx",
joiner: "joiner.int8.onnx",
tokens: "tokens.txt",
},
hashes: ModelHashes {
encoder: "2596861911cec5ca1de31adc12a7fc983d05395434f92239f4e007eeae3a5dcc",
decoder: "dc28b7ae3f5e67c0daa2d51886dae2ac8287a25333f46a363f3684b3cd1220c9",
joiner: "b4d1cff7c410d14c85c143885954be09a6a4a076cd35d22aeba58655665582bb",
tokens: "f6e134fa357558d0c4ab56fbe380323c30e3d50a13fe402a68328d5a13c2236b",
},
download_bytes: 72_800_000,
},
SpeechModel {
id: "zh",
label: "Chinese (Mandarin)",

View file

@ -297,8 +297,11 @@ mod tests {
/// zeroed — get a field wrong and this is where it shows up, rather than in
/// front of a presenter mid-take.
///
/// `TEXTREAM_TEST_MODEL_ID` picks which registry entry the directory holds,
/// defaulting to the default model.
///
/// ```text
/// TEXTREAM_TEST_MODEL_DIR=<dir> cargo test -p textream -- --ignored
/// TEXTREAM_TEST_MODEL_DIR=<dir> TEXTREAM_TEST_MODEL_ID=tr cargo test -p textream -- --ignored
/// ```
#[test]
#[ignore = "needs a downloaded speech model"]
@ -306,13 +309,11 @@ mod tests {
let Ok(directory) = std::env::var("TEXTREAM_TEST_MODEL_DIR") else {
panic!("set TEXTREAM_TEST_MODEL_DIR to a directory holding a model");
};
let files = ModelFiles {
encoder: "encoder-epoch-99-avg-1.int8.onnx",
decoder: "decoder-epoch-99-avg-1.int8.onnx",
joiner: "joiner-epoch-99-avg-1.int8.onnx",
tokens: "tokens.txt",
let model = match std::env::var("TEXTREAM_TEST_MODEL_ID") {
Ok(id) => crate::model::find(&id).unwrap_or_else(|| panic!("no model {id}")),
Err(_) => crate::model::default_model(),
};
let paths = ModelPaths::in_directory(Path::new(&directory), &files);
let paths = ModelPaths::in_directory(Path::new(&directory), &model.files);
assert!(paths.all_present(), "model files missing in {directory}");
let mut recognizer = Recognizer::new(&paths).expect("recogniser should load");

View file

@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "Textream",
"version": "1.2.0",
"version": "1.3.0",
"identifier": "dev.crtkafa.textream",
"build": {
"beforeDevCommand": "bun run dev",
@ -61,7 +61,7 @@
"runtime/sherpa-onnx-c-api.dll": "sherpa-onnx-c-api.dll",
"runtime/sherpa-onnx-cxx-api.dll": "sherpa-onnx-cxx-api.dll"
},
"copyright": "Copyright (c) 2026 CRTkafa",
"copyright": "Copyright (c) 2026 CRTkafa and Emrah",
"shortDescription": "Teleprompter for Windows",
"longDescription": "A free Windows teleprompter with real-time word tracking, classic auto-scroll and voice-activated scrolling. Everything runs on-device.",
"windows": {