Skip to main content

A simple commandline tool for calculating WERs.

Project description

simple-wer

A simple command line tool to calculate WER for ASR.

Installation

pip install simple-wer

Usage

$ simple-wer --help
Usage: simple-wer [OPTIONS] REFS HYPS

  The shell entry point to simple-wer, a simple tool to calculate WERs for
  ASR.

  The ``refs`` and ``hyps`` are the paths for references and hypothesis, their
  format should be ``utt_id \t refenence/hypothesis``.

Options:
  --test-name TEXT  The name for current test, it is used to distinguish the
                    file names for different tests.
  --logdir TEXT     The directory to write the WER results.
  --help            Show this message and exit.

For example:

The refs.txt contains:

1       I LOVE YOU
2       I HATE YOU

The hyps.txt contains:

1       i LOVE YOU
2       I hate YOU

Run the following command:

simple-wer --test-name example refs.txt hyps.txt

The logs look like:

2023-05-16 11:16:05,253 INFO [simple_wer.py:21] The transcripts are stored in logs/recogs-example.txt
2023-05-16 11:16:05,255 INFO [simple_wer.py:123] [example] %WER 33.33% [2 / 6, 0 ins, 0 del, 2 sub ]
2023-05-16 11:16:05,257 INFO [simple_wer.py:29] Wrote detailed error stats to logs/errs-example.txt

There will be two files (recogs-example.txt and errs-example.txt) in logs,

recogs-example.txt looks like:

1:      ref=['I', 'LOVE', 'YOU']
1:      hyp=['i', 'LOVE', 'YOU']

2:      ref=['I', 'HATE', 'YOU']
2:      hyp=['I', 'hate', 'YOU']

errs-example.txt looks like:

%WER = 33.33
Errors: 0 insertions, 0 deletions, 2 substitutions, over 6 reference words (4 correct)
Search below for sections starting with PER-UTT DETAILS:, SUBSTITUTIONS:, DELETIONS:, INSERTIONS:, PER-WORD STATS:

PER-UTT DETAILS: corr or (ref->hyp)  
1:      (I->i) LOVE YOU
2:      I (HATE->hate) YOU

SUBSTITUTIONS: count ref -> hyp
1   I -> i
1   HATE -> hate

DELETIONS: count ref

INSERTIONS: count hyp

PER-WORD STATS: word  corr tot_errs count_in_ref count_in_hyp
i   0 1 0 1
hate   0 1 0 1
I   1 1 2 1
HATE   0 1 1 0
YOU   2 0 2 2
LOVE   1 0 1 1

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

simple-wer-0.2.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

simple_wer-0.2-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file simple-wer-0.2.tar.gz.

File metadata

  • Download URL: simple-wer-0.2.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.12

File hashes

Hashes for simple-wer-0.2.tar.gz
Algorithm Hash digest
SHA256 c3a711ced167724ad9fc4302823aa5225aaf1fe3c02e391db18cb116c0e8c3f6
MD5 4814fb41ea7d13aba91ba563ef96b64f
BLAKE2b-256 6488c461cae892a700fd380d645c4a2f0c4241ede78ef554b420d566dd199876

See more details on using hashes here.

File details

Details for the file simple_wer-0.2-py3-none-any.whl.

File metadata

  • Download URL: simple_wer-0.2-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.12

File hashes

Hashes for simple_wer-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 98f691fb6cad90881b4dda7d4c037d41c485cbfde212c9d5c24116d51fc7db8b
MD5 d7821ce3b8ddfa82a0dd5425970f0bd6
BLAKE2b-256 7146072a30d59c02982b004048a3f69b1a09ca7a11a14b6a2466fee0b5319315

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