Skip to main content

Automatic lyrics transcription evaluation toolkit

Project description

alt-eval

An automatic lyrics transcription (ALT) evaluation toolkit, released with the Jam-ALT benchmark.

The package implements metrics designed to work well with lyrics formatted according to music industry standards (see the Jam-ALT annotation guide), namely:

  • A word error rate (WER) computed on text tokenized in a way that accounts for non-standard spellings common in song lyrics.
  • A case-sensitive WER.
  • Precision, recall and F-score for symbols important for written lyrics:
    • Punctuation
    • Parentheses (used to delimit background vocals)
    • Line breaks
    • Section breaks (i.e. double line breaks)

Under the hood, the text is pre-processed using the sacremoses tokenizer and punctuation normalizer. Note that apostrophes and single quotes are never treated as quotation marks, but as part of a word, marking an elision or a contraction.

Usage

Install the package with pip install alt-eval.

To compute the metrics:

from alt_eval import compute_metrics
compute_metrics(references, hypotheses)

where references and hypotheses are lists of strings. To specify the language (English by default), use the languages parameter, passing either a single language code, or a list of language codes corresponding to individual examples.

For Jam-ALT, use:

from datasets import load_dataset
dataset = load_dataset("audioshake/jam-alt")["test"]
compute_metrics(dataset["text"], transcriptions, languages=dataset["language"])

If you are only interested in WER, you may skip formatting- and punctuation-related metrics by passing include_other=False.

Use visualize_errors=True to also get a list of HTML snippets that can be used to visualize the errors in each transcript.

Language support

The package implements language-specific tokenization via sacremoses, enhanced with custom rules. Support is well tested for English, Spanish, German, and French.

For writing systems that do not use spaces to separate words (Chinese, Japanese, Thai, Lao, Burmese, …), each character is considered as a separate word, as per Radford et al. (2022), making the WER equivalent to CER (character error rate).

See the test cases for examples of how different languages are tokenized. Contributions adding support for additional languages are welcome.

Optional lyrics normalization

The Jam-ALT annotation guide forbids certain end-of-line punctuation and requires the first letter of each line to be uppercase. For transcription systems that do not respect these rules, the results on Jam-ALT can be improved by normalizing the transcripts using the normalize_lyrics() function, which fixes these specific issues. Note, however, that this relies on the line break predictions being correct. Moreover, other datasets may follow different rules. For these reasons, this normalization is not included as a fixed pre-processing step in compute_metrics(), and instead made optional.

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

alt_eval-1.2.0.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

alt_eval-1.2.0-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file alt_eval-1.2.0.tar.gz.

File metadata

  • Download URL: alt_eval-1.2.0.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.18

File hashes

Hashes for alt_eval-1.2.0.tar.gz
Algorithm Hash digest
SHA256 7804d88de9c0389bcdf3fa95f7f423dc47daabd65ff1ade97f89b9f53c3f7cba
MD5 fe9591aeb6c2bd2e5a6676ee04b463c6
BLAKE2b-256 d57bca5d0fa3dc2284b5f8e3bf7a8caaefb28612c0e0039816a957d49cbe5e3a

See more details on using hashes here.

File details

Details for the file alt_eval-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: alt_eval-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.18

File hashes

Hashes for alt_eval-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 db72b18b235388637eaaa9e6eeb0a5581cda08f26368a7015cd3a0edc143160d
MD5 d35ab97dcf4500bf4aa73dc9a2ee025b
BLAKE2b-256 dde219addced8565e09e7ca3cc25cad9243adede9d098ac2f56de49425b07ceb

See more details on using hashes here.

Supported by

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