Write plain transcribed text

This commit is contained in:
Rafael Caricio 2022-03-31 14:27:57 +02:00
parent 398656f9f8
commit 93a27b4a02
Signed by: rafaelcaricio
GPG key ID: 3C86DBCE8E93C947

View file

@ -112,11 +112,13 @@ fn main() -> eyre::Result<()> {
Message::Text(payload) => {
match serde_json::from_str::<Transcript>(&payload) {
Ok(transcript) => {
info!(
"result: {}",
serde_json::to_string_pretty(&transcript.result)
.unwrap()
);
let text = transcript
.result
.iter()
.map(|p| p.word.to_string())
.collect::<Vec<_>>()
.join(" ");
info!("result: {}", text);
}
Err(_) => {
// The payload is still not a final transcript, so we just ignore it