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.9 - Added some words with space in default corrections csv
- v1.0.10 - Typo in some corrections
- v1.0.11 - Added test case and fixed mistake
- v1.0.12 - Fixed pinning requirements
Metadata
Release files for commoncorrections 1.0.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| commoncorrections-1.0.12.tar.gz | 10.2 kB | Without provenance | Details for commoncorrections-1.0.12.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| commoncorrections-1.0.12-py3-none-any.whl | Python 3 | none | any | Details for commoncorrections-1.0.12-py3-none-any.whl |
Total release size: 20.9 kB
Release files / commoncorrections-1.0.12.tar.gz
| Download URL | commoncorrections-1.0.12.tar.gz |
|---|---|
| Size | 10.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9d241ba9f3477b6a39a57d2336353260d89021ca2a1624075dfab80225cf8d67
|
|
BLAKE2b-256 checksum How to use checksums |
1ee5dbc5090c12042e0413311b378329b9777971faaed225ee09e292e6e7c814
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.4
|
Release files / commoncorrections-1.0.12-py3-none-any.whl
| Download URL | commoncorrections-1.0.12-py3-none-any.whl |
|---|---|
| Size | 10.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4284dc604c26120482fdf4bf721c8ef13ddcd905fdc5f482f44cbf57274e3bc0
|
|
BLAKE2b-256 checksum How to use checksums |
e5b7c20f172884a97dbc03c4ee7c327259446bc2b7ace8013cb62c8834b09cd9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.4
|
Security for commoncorrections 1.0.12
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.