Skip to main content

The GreenKey ASRToolkit provides tools for automatic speech recognition (ASR) file conversion and corpora organization.

Project description

# GreenKey Automatic Speech Recognition (ASR) Toolkit

<img src="https://github.com/finos-voice/greenkey-voice-sdk/raw/master/logo/greenkey-logo.png" width="100" />

---

## The GreenKey ASRToolkit provides tools for file conversion and ASR corpora organization. These are intended to simplify the workflow for building, customizing, and analyzing ASR models, useful for scientists, engineers, and other technologists in speech recognition.


### convert_transcript
```text
usage: convert_transcript [-h] input_file output_file

convert between text file formats

positional arguments:
input_file input file
output_file output file

optional arguments:
-h, --help show this help message and exit
```
This tool allows for easy conversion from STM files to TXT files and back. Other file formats will be added in the near future.

### wer
```text
usage: wer [-h] [--char-level] [--ignore-nsns]
reference_file transcript_file

Compares a reference and transcript file and calculates word error rate (WER)
between these two files

positional arguments:
reference_file reference "truth" file
transcript_file transcript possibly containing errors

optional arguments:
-h, --help show this help message and exit
--char-level calculate character error rate instead of word error rate
--ignore-nsns ignore non silence noises like um, uh, etc.
```

### clean_formatting
```text
usage: clean_formatting.py [-h] files [files ...]

cleans input *.txt files and outputs *_cleaned.txt

positional arguments:
files list of input files

optional arguments:
-h, --help show this help message and exit

```
This script standardizes how abbreviations, numbers, and other formatted text is expressed so that ASR engines can easily use these files as training or testing data. Standardizing the formatting of output is essential for reproducible measurements of ASR accuracy.

### split_audio_file
```text
usage: split_audio_file [-h] [--target-dir TARGET_DIR] audio_file transcript

Split an audio file using valid segments from a transcript file. For this
utility, transcript files must contain start/stop times.

positional arguments:
audio_file input audio file
transcript transcript

optional arguments:
-h, --help show this help message and exit
--target-dir TARGET_DIR
Path to target directory
```

### prepare_audio_corpora
```text
usage: prepare_audio_corpora [-h] [--target-dir TARGET_DIR]
corpora [corpora ...]

Copy and organize specified corpora into a target directory. Training,
testing, and development sets will be created automatically if not already
defined.

positional arguments:
corpora Name of one or more directories in directory this
script is run

optional arguments:
-h, --help show this help message and exit
--target-dir TARGET_DIR
Path to target directory
```
This script scrapes a list of directories for paired STM and SPH files. If `train`, `test`, and `dev` folders are present, these labels are used for the output folder. By default, a target directory of 'input-data' will be created. Note that filenames with hyphens will be sanitized to underscores and that audio files will be forced to single channel, 16 kHz, signed PCM format. If two channels are present, only the first will be used.

### degrade_audio_file
```text
usage: degrade_audio_file input_file1.wav input_file2.wav

Degrade audio files to 8 kHz format similar to G711 codec
```
This script reduces audio quality of input audio files so that acoustic models can learn features from telephony with the G711 codec.

### extract_excel_spreadsheets

```text
usage: extract_excel_spreadsheets.py [-h] [--input-folder INPUT_FOLDER]
[--output-corpus OUTPUT_CORPUS]

convert a folder of excel spreadsheets to a corpus of text files

optional arguments:
-h, --help show this help message and exit
--input-folder INPUT_FOLDER
input folder of excel spreadsheets ending in .xls or
.xlsx
--output-corpus OUTPUT_CORPUS
output folder for storing text corpus
```

### Requirements

- Python 3.5 with `pip`

### Dependencies

To ensure your dependencies install correctly, we recommend that you upgrade your `setuptools` before proceeding further.

```sh
pip install --upgrade setuptools
```

Now you are ready to install with `pip`.

```sh
pip install -e .
```

## Contributing

### Code of Conduct

Please make sure you read and observe our [Code of Conduct].

### Pull Request process

1. Fork it
1. Create your feature branch (`git checkout -b feature/fooBar`)
1. Commit your changes (`git commit -am 'Add some fooBar'`)
1. Push to the branch (`git push origin feature/fooBar`)
1. Create a new Pull Request

## Authors

Original authors:

- [Matthew Goldey](https://github.com/mgoldey)

For all others who have aided this project, please see the [list of contributors].

## License

This project is licensed under the Apache 2.0 License - see the [LICENSE.md](LICENSE.md) file for details.

<!-- Markdown link & img defs -->


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

asrtoolkit-0.1.5.tar.gz (18.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

asrtoolkit-0.1.5-py3-none-any.whl (26.7 kB view details)

Uploaded Python 3

File details

Details for the file asrtoolkit-0.1.5.tar.gz.

File metadata

  • Download URL: asrtoolkit-0.1.5.tar.gz
  • Upload date:
  • Size: 18.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.27.0 CPython/3.5.2

File hashes

Hashes for asrtoolkit-0.1.5.tar.gz
Algorithm Hash digest
SHA256 097d6d344716b35cc49d34334f5c8f5655857509d7cecc8dc35fdd4489e03900
MD5 ae5afb579b87e271e2bfbd7a2384d7da
BLAKE2b-256 606e6e4fb76d7e60b2f46f871182319f760d0303e7360225954d18d122283f94

See more details on using hashes here.

File details

Details for the file asrtoolkit-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: asrtoolkit-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 26.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.27.0 CPython/3.5.2

File hashes

Hashes for asrtoolkit-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 2ac4b15d7371be7ac585381cbfaac41512020f9caca568134cb4d16c01655bf3
MD5 d943997f0bc17ca66e22d7bcbb5bbcf2
BLAKE2b-256 ff866de8327d62b533fcd1c41bc2a514dfb47db7aae0e073f79c982e7f65538d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page