Draft successful build, versions bump, crates up to date + custom forks of certain crates
This commit is contained in:
parent
15d33d9bc5
commit
1f03a44f33
3 changed files with 46 additions and 35 deletions
|
|
@ -33,41 +33,50 @@ pub fn recognize(data: &[i16], include_partial: bool) -> Option<String> {
|
|||
.accept_waveform(data);
|
||||
|
||||
match state {
|
||||
DecodingState::Running => {
|
||||
if include_partial {
|
||||
Some(
|
||||
RECOGNIZER
|
||||
.get()
|
||||
.unwrap()
|
||||
.lock()
|
||||
.unwrap()
|
||||
.partial_result()
|
||||
.partial
|
||||
.into(),
|
||||
)
|
||||
} else {
|
||||
None
|
||||
Ok(ds) => {
|
||||
match ds {
|
||||
DecodingState::Running => {
|
||||
if include_partial {
|
||||
Some(
|
||||
RECOGNIZER
|
||||
.get()
|
||||
.unwrap()
|
||||
.lock()
|
||||
.unwrap()
|
||||
.partial_result()
|
||||
.partial
|
||||
.into(),
|
||||
)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
DecodingState::Finalized => {
|
||||
// Result will always be multiple because we called set_max_alternatives
|
||||
Some(
|
||||
RECOGNIZER
|
||||
.get()
|
||||
.unwrap()
|
||||
.lock()
|
||||
.unwrap()
|
||||
.result()
|
||||
.multiple()
|
||||
.unwrap()
|
||||
.alternatives
|
||||
.first()
|
||||
.unwrap()
|
||||
.text
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
DecodingState::Failed => None,
|
||||
}
|
||||
},
|
||||
Err(err) => {
|
||||
error!("Vosk accept waveform error.\nError details: {}", err);
|
||||
|
||||
None
|
||||
}
|
||||
DecodingState::Finalized => {
|
||||
// Result will always be multiple because we called set_max_alternatives
|
||||
Some(
|
||||
RECOGNIZER
|
||||
.get()
|
||||
.unwrap()
|
||||
.lock()
|
||||
.unwrap()
|
||||
.result()
|
||||
.multiple()
|
||||
.unwrap()
|
||||
.alternatives
|
||||
.first()
|
||||
.unwrap()
|
||||
.text
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
DecodingState::Failed => None,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue