1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
//! Rust transcription with native CoreML Parakeet v2 inference
//!
//! `scriptrs` is currently a narrow macOS-first transcription crate:
//!
//! - macOS only
//! - CoreML only
//! - Parakeet TDT v2 only
//! - mono 16kHz `&[f32]` input
//!
//! The base crate exposes a single-chunk [`TranscriptionPipeline`]. Fast
//! long-audio chunking and overlap merging are available behind the
//! `long-form` feature via [`LongFormTranscriptionPipeline`]. VAD-backed speech
//! region planning is an additional `long-form-vad` feature.
//!
//! # Choosing a pipeline
//!
//! Use [`TranscriptionPipeline`] when your audio already fits in one Parakeet
//! window. If the input is too long, it returns [`TranscriptionError::AudioTooLong`].
//!
//! Use [`LongFormTranscriptionPipeline`] with the `long-form` feature when you
//! want `scriptrs` to own long-audio chunking internally. This default path is
//! tuned for speed and works well on dense, mostly continuous speech.
//!
//! Add `long-form-vad` when you need VAD-backed speech region planning for
//! sparse speech, long silences, or recordings with a lot of non-speech audio.
//!
//! # Model loading
//!
//! With the default `online` feature, [`TranscriptionPipeline::from_pretrained`]
//! and [`LongFormTranscriptionPipeline::from_pretrained`] download the runtime
//! bundle from `avencera/scriptrs-models` on Hugging Face.
//!
//! If you already manage models yourself, use [`TranscriptionPipeline::from_dir`]
//! or [`LongFormTranscriptionPipeline::from_dir`] with a local bundle layout:
//!
//! ```text
//! models/
//! parakeet-v2/
//! encoder.mlmodelc/
//! decoder.mlmodelc/
//! joint-decision.mlmodelc/
//! vocab.txt
//! ```
//!
//! With `long-form-vad`, add:
//!
//! ```text
//! models/
//! vad/
//! silero-vad.mlmodelc/
//! ```
//!
//! You can also override model resolution with environment variables:
//!
//! - `SCRIPTRS_MODELS_DIR=/path/to/models`
//! - `SCRIPTRS_MODELS_REPO=owner/repo`
//!
//! # Input requirements
//!
//! `scriptrs` expects mono 16kHz audio samples as `&[f32]`. File decoding stays
//! outside the core library on purpose.
//!
//! # Examples
//!
//! Single-chunk transcription:
//!
//! ```no_run
//! use scriptrs::TranscriptionPipeline;
//!
//! # fn load_audio() -> Vec<f32> { Vec::new() }
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let audio = load_audio();
//! let pipeline = TranscriptionPipeline::from_pretrained()?;
//! let result = pipeline.run(&audio)?;
//!
//! println!("{}", result.text);
//! # Ok(())
//! # }
//! ```
//!
//! Long-form transcription:
//!
//! ```no_run
//! # #[cfg(feature = "long-form")]
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! use scriptrs::LongFormTranscriptionPipeline;
//!
//! # fn load_audio() -> Vec<f32> { Vec::new() }
//! let audio = load_audio();
//! let pipeline = LongFormTranscriptionPipeline::from_pretrained()?;
//! let result = pipeline.run(&audio)?;
//!
//! println!("{}", result.text);
//! # Ok(())
//! # }
//! # #[cfg(not(feature = "long-form"))]
//! # fn main() {}
//! ```
//!
//! VAD-backed long-form transcription:
//!
//! ```no_run
//! # #[cfg(feature = "long-form-vad")]
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! use scriptrs::{LongFormConfig, LongFormMode, LongFormTranscriptionPipeline};
//!
//! # fn load_audio() -> Vec<f32> { Vec::new() }
//! let audio = load_audio();
//! let pipeline = LongFormTranscriptionPipeline::from_pretrained()?;
//! let config = LongFormConfig {
//! mode: LongFormMode::Vad,
//! ..LongFormConfig::default()
//! };
//! let result = pipeline.run_with_config(&audio, &config)?;
//!
//! println!("{}", result.text);
//! # Ok(())
//! # }
//! # #[cfg(not(feature = "long-form-vad"))]
//! # fn main() {}
//! ```
pub use TranscriptionConfig;
pub use TranscriptionError;
pub use ;
pub use ;
pub use ModelBundle;
pub use ModelManager;
pub use TranscriptionPipeline;
pub use ;