ASR Regex Post Processing
Regex snippets for cleaning up speech-to-text output — Android (ICU) first, with Linux engine differences flagged and machine-checked.
About This Project
ASR Regex Post-Processing is a notebook of regular expressions for cleaning up speech-to-text output, with a focus on Android dictation apps that offer a post-processing step after transcription. It treats regex as a cheap, deterministic stage that can run before an LLM-based post-processor or serve as the only cleanup step. The current topic covers disfluencies such as fillers, stutters, false starts, and verbal tics, and planned topics include spoken punctuation, voice commands, number and entity normalisation, Whisper hallucination removal, and typographic normalisation.
Each snippet is written as a markdown entry containing a pattern, a replacement, worked test cases, and a risk rating. The project's central rule is that every snippet must be a valid regular expression on Android's ICU engine, and differences from desktop Java, Python, Perl, and sed are documented in a separate engine comparison. A Python validation script runs the test lines through four engines, writes a compatibility report, and exits with a non-zero status if any snippet fails on Android. The script requires no Python packages, relying instead on the ICU runtime library, a JDK, and Perl.
The project is likely to be useful to developers building or configuring dictation tools, particularly those supporting regex replacement rules, and to anyone who needs lightweight, predictable text cleanup for transcribed speech. It is released under the MIT license.