Skip to main content

clean_transcript

Function clean_transcript 

Source
pub fn clean_transcript(raw: &str) -> String
Expand description

Normalise an STT transcript for typing into the audio-response field.

reCAPTCHA’s audio answers are space-separated words/digits; STT engines love to add capitalisation and trailing punctuation. The response field is matched case-insensitively but stray punctuation counts as wrong characters.

§Examples

use captchaforge::solver::clean_transcript;
assert_eq!(clean_transcript("  Hello, World.  "), "hello world");
assert_eq!(clean_transcript("five seven, nine!"), "five seven nine");
assert_eq!(clean_transcript("\nthree\tfour\n"), "three four");
assert_eq!(clean_transcript(""), "");