A small python implementation of common ASR corrections
Project description
CC - CommonCorrections
A simple repo that is used to correct common ASR outputs. The aim is not on mistakes but different ways of transcribing the same thing with a focus on how something may sound as opposed to the shortened form. The primary use case is to align the ground-truth and output from ASRs just before the WER is calculated.
Static Examples
there's -> there is
google.com -> google dot com
Dynamic Examples
1 2 3 -> one two three
53.4 -> fifty three point four
23:59 -> twenty three fifty nine
Features
- Designed to be used and fast (ish) with Pandas dataframes
- Lots of built in corrections for free
- Ability to easily extend with private corrections
Getting Started
- Install with:
pip install commoncorrections
- Import with:
from commoncorrections import CommonCorrections
Usage Examples
Turn numbers into words:
>>> cc = CommonCorrections()
>>> print(cc.correct_str("1 2 3"))
one two three
Turn times into words:
>>> cc = CommonCorrections()
>>> print(cc.correct_str("23:59"))
twenty three fifty nine
Correct a pandas dataframe:
df = pd.DataFrame(data={"transcript": ['5 4 3', "123 the time is 1:23"],
"asr_1": ["five four three", "one two three the time is one twenty three"],
"filename": ["./my_local_file.wav", "file2.wav"]})
cc = CommonCorrections()
# to correct only specific columns
new_df = cc.correct_df(df, column_list=['transcript', 'asr_1'])
# to apply to whole dataframe
new_whole_df = cc.correct_df(df)
mypy Type Checks
I tested installing mypy to check that types are compatible
(py) rob@rob-T480s:~/projects/CommonCorrections/commoncorrections (master)$ mypy commoncorrections.py
Success: no issues found in 1 source file
Change Log
- v1.0.0 - First release
- v1.0.1 - Fixed packaging issue
- v1.0.3 - Fixed pip packaging issue
- v1.0.4 - Fixed pip packaging issue
- v1.0.5 - Fixed issue single digits
- v1.0.6 - Fixed case where dataframe contains a non-str type (e.g. int)
- v1.0.7 - Fixed adding additional dict works and added print(cc) object
- v1.0.8 - Fixed print bug with repl
- v1.0.8 - Added some words with space in default corrections csv
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
commoncorrections-1.0.9.tar.gz
(10.2 kB
view hashes)
Built Distribution
Close
Hashes for commoncorrections-1.0.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bbe2c801d23ddf2b12b76a39cb69eb3e27ee8a2212ce400646a05b6246a19ddc |
|
MD5 | a8d6fa9f09064ad50447a486991b605d |
|
BLAKE2b-256 | 588f1b80b814ddd622f2542605a3de97df7f07d9d01eafed0d2fa9bfdeddcd93 |