docs.rs failed to build viet-asr-0.1.0-dev.4
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
vietasr — Rust binding
Offline Vietnamese Speech AI SDK for Rust. Safe wrapper over the same C ABI that powers every other vietasr binding.
Install
[]
= "0.1.0"
The crate links libvietasr via build.rs. Point it at a built core with the VIETASR_NATIVE_DIR environment variable, or vendor the libraries under _native/.
Quickstart
Streaming
let pipeline = preset?;
let mut session = pipeline.stream?;
for chunk in mic_chunks
println!;
Custom pipeline
let mut pipeline = new;
pipeline
.add?
.add?
.add?
.add?
.build?;
let result = pipeline.transcribe_file?;
println!;
println!;
API
| Item | Signature | Notes |
|---|---|---|
Pipeline::preset |
(name: &str) -> Result<Pipeline> |
model bundled in the SDK |
Pipeline::new |
() -> Pipeline |
empty pipeline |
Pipeline::add |
(&mut self, module: &str) -> Result<&mut Self> |
fluent |
Pipeline::add_with_config |
(&mut self, module: &str, json: &str) -> Result<&mut Self> |
|
Pipeline::set_backend |
(&mut self, Backend) -> Result<&mut Self> |
Auto/Onnx/CoreMl |
Pipeline::set_model_dir |
(&mut self, dir: &str) -> Result<&mut Self> |
|
Pipeline::build |
(&mut self) -> Result<&mut Self> |
|
Pipeline::transcribe_file |
(&self, path: &str) -> Result<TranscriptResult> |
|
Pipeline::transcribe_buffer |
(&self, &[i16], f32) -> Result<TranscriptResult> |
|
Pipeline::stream |
(&self, sample_rate: f32) -> Result<Session> |
|
Session::accept_i16 |
(&mut self, &[i16]) -> bool |
true if endpoint reached |
Session::accept_f32 |
(&mut self, &[f32]) -> bool |
|
Session::partial / result |
(&self) -> TranscriptResult |
|
Session::finalize |
(&mut self) -> TranscriptResult |
|
Session::reset |
(&mut self) |
|
TranscriptResult::text / partial |
(&self) -> String |
|
TranscriptResult::is_final |
(&self) -> bool |
|
TranscriptResult::raw_json |
field | full JSON envelope |
list_modules / list_presets |
() -> Vec<String> |
|
version |
() -> String |
Pipeline and Session are Send; both free their native handle on Drop.
Build from source
Thread safety
- One
Pipelinecan serve many concurrentSessions — each Session has independent state. - See docs/thread-safety.md.
Models
The vietasr model is bundled inside the SDK — no download, no network. model.onnx
is committed to the repo as <50 MB chunks and baked into the native libvietasr this
crate links against.