Compare commits

..

No commits in common. "7a64011810c7684e1761ebe37beaf9598239f412" and "c912ff371f043ebe2717af008742fa1476fe1132" have entirely different histories.

12 changed files with 40 additions and 170 deletions

View file

@ -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

4
Cargo.lock generated
View file

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

View file

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

View file

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

View file

@ -14,20 +14,13 @@
<p align="center"> <p align="center">
The Windows port of <a href="https://github.com/f/textream"><strong>Textream</strong></a> 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> </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.3.** All three guidance modes work end to end. Speech recognition > **v1.0.** All three guidance modes work end to end. Speech recognition
> covers several languages, Turkish included — see > covers several languages but not Turkish yet — see
> [Languages](#languages). > [Languages](#languages).
<p align="center"> <p align="center">
@ -178,15 +171,13 @@ exactly when somebody has published a streaming model for it:
| English (small) — fastest, the default | 42 MB | | English (small) — fastest, the default | 42 MB |
| English, German, French | 71 MB each | | English, German, French | 71 MB each |
| Spanish | 156 MB | | Spanish | 156 MB |
| Turkish | 73 MB |
| Chinese (Mandarin) | 77 MB | | Chinese (Mandarin) | 77 MB |
| Arabic, Indonesian, Japanese, Russian, Thai, Vietnamese (one model) | 339 MB | | Arabic, Indonesian, Japanese, Russian, Thai, Vietnamese (one model) | 339 MB |
Turkish uses [seda-v0.1](https://huggingface.co/atasoglu/seda-v0.1), a **Turkish is not available yet.** A model exists — Kroko publishes a Turkish
streaming Zipformer2 transducer trained on Common Voice and the ISSAI Turkish community streaming model — but only in their own packaging, and nobody has
Speech Corpus (Apache-2.0). Its transcripts are lowercase, so the matcher folds converted it to the ONNX layout sherpa-onnx loads. That conversion is the whole
`I`, `İ`, `i` and `ı` together — Unicode's default lowercase gets Turkish wrong, job; the app already handles everything after it.
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 Adding a language is a few lines in [`model.rs`](src-tauri/src/model.rs) and a
published model to point at. 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 Reviewed false positives live in `privacy-allowlist.txt`. It needs CMake and
7-Zip, and only an installer that passed is published. 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: Run the test suite:
```bash ```bash
@ -281,7 +266,7 @@ cargo test --workspace
- [x] Classic and Voice-Activated modes end to end - [x] Classic and Voice-Activated modes end to end
- [x] On-device streaming speech recognition — Word Tracking works - [x] On-device streaming speech recognition — Word Tracking works
- [x] A model registry covering several languages - [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] Settings that persist across launches
- [x] Font, size, colour and opacity - [x] Font, size, colour and opacity
- [x] Pause, hold, and mute from the transport dock - [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. approach to word tracking are all his design.
- Original macOS app: [github.com/f/textream](https://github.com/f/textream) - Original macOS app: [github.com/f/textream](https://github.com/f/textream)
- Textream for Windows: [CRTkafa](https://x.com/CRTkafa) and - Windows port: [CRT](https://git.crt.fyi/CRT)
[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 Speech recognition uses [sherpa-onnx](https://github.com/k2-fsa/sherpa-onnx) by
the k2-fsa team, with streaming models published by the k2-fsa team, with streaming models published by
[csukuangfj](https://huggingface.co/csukuangfj) and, for Turkish, [csukuangfj](https://huggingface.co/csukuangfj).
[atasoglu](https://huggingface.co/atasoglu).
The dyslexia-friendly typeface is The dyslexia-friendly typeface is
[OpenDyslexic](https://opendyslexic.org) by Abbie Gonzalez, bundled under the [OpenDyslexic](https://opendyslexic.org) by Abbie Gonzalez, bundled under the

View file

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

View file

@ -118,27 +118,6 @@ pub fn infer_direction(text: &str) -> TextDirection {
TextDirection::LeftToRight 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 /// Splits `text` into owned grapheme clusters — the unit every offset in this
/// crate is measured in. /// crate is measured in.
pub fn graphemes(text: &str) -> Vec<String> { pub fn graphemes(text: &str) -> Vec<String> {
@ -209,27 +188,6 @@ mod tests {
assert_eq!(graphemes("a👍🏽b").len(), 3); 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] #[test]
fn readability_ignores_punctuation_and_emoji() { fn readability_ignores_punctuation_and_emoji() {
assert!(is_readable("word")); assert!(is_readable("word"));

View file

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

View file

@ -16,8 +16,6 @@ const root = dirname(dirname(fileURLToPath(import.meta.url)));
const { version } = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8')); const { version } = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8'));
const installer = join(root, 'target', 'release', 'bundle', 'nsis', `Textream_${version}_x64-setup.exe`); 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']; 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]) { function run(step, [command, ...args]) {
console.log(`\n== ${step}`); console.log(`\n== ${step}`);
@ -37,5 +35,5 @@ if (!existsSync(installer)) {
console.error(`release: the build left no ${installer}`); console.error(`release: the build left no ${installer}`);
process.exit(1); 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}`); console.log(`\nClean. Publishable: ${installer}`);

View file

@ -132,25 +132,6 @@ pub const MODELS: &[SpeechModel] = &[
}, },
download_bytes: 156_200_000, 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 { SpeechModel {
id: "zh", id: "zh",
label: "Chinese (Mandarin)", label: "Chinese (Mandarin)",

View file

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

View file

@ -1,7 +1,7 @@
{ {
"$schema": "https://schema.tauri.app/config/2", "$schema": "https://schema.tauri.app/config/2",
"productName": "Textream", "productName": "Textream",
"version": "1.3.0", "version": "1.2.0",
"identifier": "dev.crtkafa.textream", "identifier": "dev.crtkafa.textream",
"build": { "build": {
"beforeDevCommand": "bun run dev", "beforeDevCommand": "bun run dev",
@ -61,7 +61,7 @@
"runtime/sherpa-onnx-c-api.dll": "sherpa-onnx-c-api.dll", "runtime/sherpa-onnx-c-api.dll": "sherpa-onnx-c-api.dll",
"runtime/sherpa-onnx-cxx-api.dll": "sherpa-onnx-cxx-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", "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.", "longDescription": "A free Windows teleprompter with real-time word tracking, classic auto-scroll and voice-activated scrolling. Everything runs on-device.",
"windows": { "windows": {