diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml deleted file mode 100644 index 7daa371..0000000 --- a/.forgejo/workflows/release.yml +++ /dev/null @@ -1,33 +0,0 @@ -# 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 diff --git a/Cargo.lock b/Cargo.lock index 9830d12..57bb169 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3111,7 +3111,7 @@ dependencies = [ [[package]] name = "prompt-core" -version = "1.3.0" +version = "1.2.0" dependencies = [ "unicode-segmentation", ] @@ -4396,7 +4396,7 @@ dependencies = [ [[package]] name = "textream" -version = "1.3.0" +version = "1.2.0" dependencies = [ "cpal", "prompt-core", diff --git a/Cargo.toml b/Cargo.toml index 5a49a81..55cc2b7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,11 +3,11 @@ members = ["crates/prompt-core", "src-tauri"] resolver = "2" [workspace.package] -version = "1.3.0" +version = "1.2.0" edition = "2021" rust-version = "1.80" license = "MIT" -authors = ["CRTkafa", "Emrah"] +authors = ["CRTkafa"] [workspace.dependencies] unicode-segmentation = "1.12" diff --git a/LICENSE b/LICENSE index 6b3bf77..5c25383 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2026 CRTkafa and Emrah +Copyright (c) 2026 CRTkafa Portions of the script-alignment, cue-handling and voice-activity logic are reimplementations of algorithms from Textream (https://github.com/f/textream), diff --git a/README.md b/README.md index b80aa15..8a4162d 100644 --- a/README.md +++ b/README.md @@ -14,20 +14,13 @@

The Windows port of Textream - by Fatih Kadir Akın, - made by CRTkafa and Emrah + by Fatih Kadir Akın

-> 🇹🇷 **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.3.** All three guidance modes work end to end. Speech recognition -> covers several languages, Turkish included — see +> **v1.0.** All three guidance modes work end to end. Speech recognition +> covers several languages but not Turkish yet — see > [Languages](#languages).

@@ -178,15 +171,13 @@ 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 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. +**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. Adding a language is a few lines in [`model.rs`](src-tauri/src/model.rs) and a published model to point at. @@ -260,12 +251,6 @@ 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 @@ -281,7 +266,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 -- [x] Turkish +- [ ] Turkish, once a streaming model is converted for it - [x] Settings that persist across launches - [x] Font, size, colour and opacity - [x] Pause, hold, and mute from the transport dock @@ -315,18 +300,11 @@ 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) -- 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) +- Windows port: [CRT](https://git.crt.fyi/CRT) 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) and, for Turkish, -[atasoglu](https://huggingface.co/atasoglu). +[csukuangfj](https://huggingface.co/csukuangfj). The dyslexia-friendly typeface is [OpenDyslexic](https://opendyslexic.org) by Abbie Gonzalez, bundled under the diff --git a/crates/prompt-core/src/matcher.rs b/crates/prompt-core/src/matcher.rs index b7d277a..6c7cbde 100644 --- a/crates/prompt-core/src/matcher.rs +++ b/crates/prompt-core/src/matcher.rs @@ -21,7 +21,7 @@ use crate::alignment::{ DEFAULT_AGREEMENT_TOLERANCE, }; use crate::script::PromptScript; -use crate::text::{fold_case, graphemes, is_readable, split_into_words}; +use crate::text::{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,10 +54,15 @@ impl PromptMatcher { source.annotation_ranges(), offset.min(source.character_count()), ); - // 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(); + // 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(); Self { source, @@ -169,7 +174,7 @@ impl PromptMatcher { /// transcript reaches. fn character_level_match(&self, spoken: &str) -> usize { let source = &self.lowered[self.match_start_offset..]; - let spoken: Vec = graphemes(&fold_case(spoken)) + let spoken: Vec = graphemes(&spoken.to_lowercase()) .into_iter() .filter(|g| is_readable(g) || g.chars().all(char::is_whitespace)) .collect(); @@ -252,7 +257,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(&fold_case(spoken)); + let spoken_words = split_into_words(&spoken.to_lowercase()); let mut source_index = 0usize; let mut spoken_index = 0usize; @@ -260,9 +265,9 @@ impl PromptMatcher { let mut inside_annotation = false; let alnum = |word: &str| -> String { - fold_case(word) - .chars() + word.chars() .filter(|c| c.is_alphanumeric()) + .flat_map(char::to_lowercase) .collect() }; let width = |word: &str| graphemes(word).len(); @@ -589,22 +594,6 @@ 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"); diff --git a/crates/prompt-core/src/text.rs b/crates/prompt-core/src/text.rs index 37555fd..3f55437 100644 --- a/crates/prompt-core/src/text.rs +++ b/crates/prompt-core/src/text.rs @@ -118,27 +118,6 @@ 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 { @@ -209,27 +188,6 @@ 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")); diff --git a/package.json b/package.json index e6c3fc2..74667fb 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "textream-windows", "private": true, - "version": "1.3.0", + "version": "1.2.0", "type": "module", "scripts": { "dev": "vite", diff --git a/scripts/release.mjs b/scripts/release.mjs index a3cf818..e826bac 100644 --- a/scripts/release.mjs +++ b/scripts/release.mjs @@ -16,8 +16,6 @@ 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}`); @@ -37,5 +35,5 @@ if (!existsSync(installer)) { console.error(`release: the build left no ${installer}`); process.exit(1); } -run('scan the installer', [...scanner, installer, '--allow', join(root, 'privacy-allowlist.txt')]); +run('scan the installer', [...waybetter, 'privacy-scan', installer, '--allow', join(root, 'privacy-allowlist.txt')]); console.log(`\nClean. Publishable: ${installer}`); diff --git a/src-tauri/src/model.rs b/src-tauri/src/model.rs index 35a47ff..4312a4a 100644 --- a/src-tauri/src/model.rs +++ b/src-tauri/src/model.rs @@ -132,25 +132,6 @@ 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)", diff --git a/src-tauri/src/speech.rs b/src-tauri/src/speech.rs index 9fc95e0..5641983 100644 --- a/src-tauri/src/speech.rs +++ b/src-tauri/src/speech.rs @@ -297,11 +297,8 @@ 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=

TEXTREAM_TEST_MODEL_ID=tr cargo test -p textream -- --ignored + /// TEXTREAM_TEST_MODEL_DIR= cargo test -p textream -- --ignored /// ``` #[test] #[ignore = "needs a downloaded speech model"] @@ -309,11 +306,13 @@ 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 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 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 paths = ModelPaths::in_directory(Path::new(&directory), &model.files); + let paths = ModelPaths::in_directory(Path::new(&directory), &files); assert!(paths.all_present(), "model files missing in {directory}"); let mut recognizer = Recognizer::new(&paths).expect("recogniser should load"); diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index c993e50..20542c1 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "Textream", - "version": "1.3.0", + "version": "1.2.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 and Emrah", + "copyright": "Copyright (c) 2026 CRTkafa", "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": {