{"id":18410974,"url":"https://github.com/analyticsinmotion/werpy","last_synced_at":"2025-04-07T10:32:39.244Z","repository":{"id":157918780,"uuid":"632764614","full_name":"analyticsinmotion/werpy","owner":"analyticsinmotion","description":"🐍📦 Rapidly calculate and analyze the Word Error Rate (WER) with this powerful yet lightweight Python package.","archived":false,"fork":false,"pushed_at":"2025-04-07T04:41:54.000Z","size":546,"stargazers_count":12,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-07T05:28:14.549Z","etag":null,"topics":["asr","asr-evaluation","automatic-speech-recognition","levenshtein-distance","metrics","nlp","python","python-package","speech-to-text","stt","stt-benchmark","wer","werpy","word-error-rate"],"latest_commit_sha":null,"homepage":"https://www.analyticsinmotion.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/analyticsinmotion.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-26T04:51:27.000Z","updated_at":"2025-04-07T04:41:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"d22ba205-8849-46db-97c1-fd9d97973fc9","html_url":"https://github.com/analyticsinmotion/werpy","commit_stats":{"total_commits":275,"total_committers":2,"mean_commits":137.5,"dds":"0.0036363636363636598","last_synced_commit":"8cd3f462f57b77b8b49d50aa2a0ebe9d72d12e69"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/analyticsinmotion%2Fwerpy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/analyticsinmotion%2Fwerpy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/analyticsinmotion%2Fwerpy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/analyticsinmotion%2Fwerpy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/analyticsinmotion","download_url":"https://codeload.github.com/analyticsinmotion/werpy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247601348,"owners_count":20964861,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asr","asr-evaluation","automatic-speech-recognition","levenshtein-distance","metrics","nlp","python","python-package","speech-to-text","stt","stt-benchmark","wer","werpy","word-error-rate"],"created_at":"2024-11-06T03:34:43.499Z","updated_at":"2025-04-07T10:32:39.236Z","avatar_url":"https://github.com/analyticsinmotion.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n![werpy-logo-word-error-rate](https://user-images.githubusercontent.com/52817125/235063664-2f21629c-0fad-46b6-a487-c2b5ef6f80e9.png)\n\n\u003ch1 align=\"center\"\u003eWord Error Rate for Python\n\u003ca href=\"https://twitter.com/intent/tweet?text=Introducing%20%23werpy%20-%20the%20Python%20package%20for%20fast%20and%20accurate%20Word%20Error%20Rate%20(WER)%20calculation.%20Analyze%20text%20accuracy%2C%20enhance%20%23NLP%20models%2C%20and%20improve%20%23SpeechRecognition%20systems.%20Try%20it%20now%3A%20\u0026url=https://github.com/analyticsinmotion/werpy\u0026via=analyticsmotion\u0026hashtags=PythonPackage,WordErrorRate,WER,NLP\"\u003e\n    \u003cimg src=\"https://img.shields.io/twitter/url/http/shields.io.svg?style=social\" alt=\"Tweet\"\u003e\n  \u003c/a\u003e\n\u003c/h1\u003e\n\n\n\u003c!-- badges: start --\u003e\n\n| | |\n| --- | --- |\n| Meta | [![Python Version](https://img.shields.io/badge/python-3.10%7C3.11%7C3.12%7C3.13-blue?logo=python\u0026logoColor=ffdd54)](https://www.python.org/downloads/)\u0026nbsp;\u0026nbsp; [![Black Code Style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\u0026nbsp;\u0026nbsp; [![Documentation Status](https://readthedocs.org/projects/werpy/badge/?version=latest)](https://werpy.readthedocs.io/en/latest/?badge=latest)\u0026nbsp;\u0026nbsp; [![Analytics in Motion](https://raw.githubusercontent.com/analyticsinmotion/.github/main/assets/images/analytics-in-motion-github-badge-rounded.svg)](https://www.analyticsinmotion.com) |\n| License | [![werpy License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](https://github.com/analyticsinmotion/werpy/blob/main/LICENSE)\u0026nbsp;\u0026nbsp; [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fanalyticsinmotion%2Fwerpy.svg?type=small)](https://app.fossa.com/projects/git%2Bgithub.com%2Fanalyticsinmotion/werpy?ref=badge_small)\u0026nbsp;\u0026nbsp; [![REUSE status](https://api.reuse.software/badge/github.com/analyticsinmotion/werpy)](https://api.reuse.software/info/github.com/analyticsinmotion/werpy) |\n| Security | [![CodeQL](https://github.com/analyticsinmotion/werpy/actions/workflows/codeql.yml/badge.svg)](https://github.com/analyticsinmotion/werpy/actions/workflows/codeql.yml)\u0026nbsp;\u0026nbsp; [![Codacy Security Scan](https://github.com/analyticsinmotion/werpy/actions/workflows/codacy.yml/badge.svg)](https://github.com/analyticsinmotion/werpy/actions/workflows/codacy.yml)\u0026nbsp;\u0026nbsp; [![Bandit](https://github.com/analyticsinmotion/werpy/actions/workflows/bandit.yml/badge.svg)](https://github.com/analyticsinmotion/werpy/actions/workflows/bandit.yml) |\n| Testing | [![CodeFactor](https://www.codefactor.io/repository/github/analyticsinmotion/werpy/badge)](https://www.codefactor.io/repository/github/analyticsinmotion/werpy)\u0026nbsp;\u0026nbsp; [![CircleCI](https://dl.circleci.com/status-badge/img/gh/analyticsinmotion/werpy/tree/main.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/analyticsinmotion/werpy/tree/main)\u0026nbsp;\u0026nbsp; [![codecov](https://codecov.io/gh/analyticsinmotion/werpy/graph/badge.svg?token=GGT823AVM8)](https://codecov.io/gh/analyticsinmotion/werpy) |\n| Package | [![Pypi](https://img.shields.io/pypi/v/werpy?label=PyPI\u0026color=blue)](https://pypi.org/project/werpy/)\u0026nbsp;\u0026nbsp; [![PyPI Downloads](https://img.shields.io/pypi/dm/werpy?label=PyPI%20downloads)](https://pypi.org/project/werpy/)\u0026nbsp;\u0026nbsp; [![Downloads](https://static.pepy.tech/badge/werpy)](https://pepy.tech/project/werpy)\u0026nbsp;\u0026nbsp; [![PyPI - Trusted Publisher](https://img.shields.io/badge/PyPI-Trusted%20Publisher-blue)](https://pypi.org/project/werpy/) |\n\n\u003c!-- badges: end --\u003e\n\n\n\n\n## What is werpy?\n**werpy** is an ultra-fast, lightweight Python package for calculating and analyzing Word Error Rate (WER) between two sets of text.  \n\u003cbr\u003e\nBuilt for flexibility and ease of use, it supports multiple input types such as strings, lists, and NumPy arrays—making it ideal for everything from quick experiments to large-scale evaluations.  \n\u003cbr\u003e\nDesigned for speed at any scale, werpy leverages the power of C/C++ to significantly accelerate its complex calculations, resulting in blazingly fast performance. Whether you're working with a handful of transcripts or millions of rows, werpy delivers results with exceptional speed.  \n\u003cbr\u003e\nIt also comes packed with powerful features, including:  \n- 🔤 Built-in text normalization to handle data inconsistencies  \n- ⚙️ Customizable error penalties for insertions, deletions, and substitutions  \n- 📋 A detailed summary output for in-depth error analysis  \n\nwerpy is a quality-focused package, built to production-grade standards for reliability and robustness.\n\u003cbr /\u003e\n\n\n\u003c!--\n**werpy** is a powerful yet lightweight Python package that rapidly calculates and analyzes the Word Error Rate (WER) between two sets of text. \nIt has been designed with the flexibility to handle multiple input data types such as strings, lists and NumPy arrays.\u003cbr /\u003e\n\nThe package also includes a full set of features such as normalizing the input text to account for data collection variability and the capability to easily assign different weights/penalties to specific error classifications (insertions, deletions, and substitutions).\nAdditionally, the summary function provides a comprehensive breakdown of the calculated results to assist in analyzing the specific errors quickly and in more detail.\n\u003cbr /\u003e\n--\u003e\n\n## Functions available in werpy\nThe following table provides an overview of the functions that can be used in werpy.\n\n| Function  | Description | \n| ------------- | ------------- |\n| normalize(text)  | Preprocess input text to remove punctuation, remove duplicated spaces, leading/trailing blanks and convert all words to lowercase. |\n| wer(reference, hypothesis)  | Calculate the overall Word Error Rate for the entire reference and hypothesis texts. |\n| wers(reference, hypothesis)  | Calculates a list of the Word Error Rates for each of the reference and hypothesis texts. |\n| werp(reference, hypothesis)  | Calculates a weighted Word Error Rate for the entire reference and hypothesis texts. |\n| werps(reference, hypothesis)  | Calculates a list of weighted Word Error Rates for each of the reference and hypothesis texts. |\n| summary(reference, hypothesis)  | Provides a comprehensive breakdown of the calculated results including the WER, Levenshtein Distance and all the insertion, deletion and substitution errors. |\n| summaryp(reference, hypothesis)  | Delivers an in-depth breakdown of the results, covering metrics like WER, Levenshtein Distance, and a detailed account of insertion, deletion, and substitution errors, inclusive of the weighted WER. |\n\n\n## Installation\nYou can install the latest **werpy** release with Python's pip package manager:\n\n```python\n# Install werpy from PyPi\npip install werpy\n```\n\n\n## Usage\n**Import the werpy package**\n\n*Python Code:*\n```python\nimport werpy\n```\n\u003cbr /\u003e\n\n**Example 1 - Normalize a list of text**\n\n*Python Code:*\n```python\ninput_data = [\"It's very popular in Antarctica.\",\"The Sugar Bear character\"]\nreference = werpy.normalize(input_data)\nprint(reference)\n```\n\n*Results Output:*\n```\n['its very popular in antarctica', 'the sugar bear character']\n```\n\u003cbr /\u003e\n\n**Example 2 - Calculate the overall Word Error Rate on a set of strings**\n\n*Python Code:*\n```python\nwer = werpy.wer('i love cold pizza', 'i love pizza')\nprint(wer)\n```\n\n*Results Output:*\n```\n0.25\n```\n\u003cbr /\u003e\n\n**Example 3 - Calculate the overall Word Error Rate on a set of lists**\n\n*Python Code:*\n```python\nref = ['i love cold pizza','the sugar bear character was popular']\nhyp = ['i love pizza','the sugar bare character was popular']\nwer = werpy.wer(ref, hyp)\nprint(wer)\n```\n\n*Results Output:*\n```\n0.2\n```\n\u003cbr /\u003e\n\n**Example 4 - Calculate the Word Error Rates for each set of texts**\n\n*Python Code:*\n```python\nref = ['no one else could claim that','she cited multiple reasons why']\nhyp = ['no one else could claim that','she sighted multiple reasons why']\nwers = werpy.wers(ref, hyp)\nprint(wers)\n```\n\n*Results Output:*\n```\n[0.0, 0.2]\n```\n\u003cbr /\u003e\n\n**Example 5 - Calculate the weighted Word Error Rates for the entire set of text**\n\n*Python Code:*\n```python\nref = ['it was beautiful and sunny today']\nhyp = ['it was a beautiful and sunny day']\nwerp = werpy.werp(ref, hyp, insertions_weight=0.5, deletions_weight=0.5, substitutions_weight=1)\nprint(werp)\n```\n\n*Results Output:*\n```\n0.25\n```\n\u003cbr /\u003e\n\n**Example 6 - Calculate a list of weighted Word Error Rates for each of the reference and hypothesis texts**\n\n*Python Code:*\n```python\nref = ['it blocked sight lines of central park', 'her father was an alderman in the city government']\nhyp = ['it blocked sightlines of central park', 'our father was an elder man in the city government']\nwerps = werpy.werps(ref, hyp, insertions_weight = 0.5, deletions_weight = 0.5, substitutions_weight = 1)\nprint(werps)\n```\n\n*Results Output:*\n```\n[0.21428571428571427, 0.2777777777777778]\n```\n\u003cbr /\u003e\n\n**Example 7 - Provide a complete breakdown of the Word Error Rate calculations for each of the reference and hypothesis texts**\n\n*Python Code:*\n```python\nref = ['it is consumed domestically and exported to other countries', 'rufino street in makati right inside the makati central business district', 'its estuary is considered to have abnormally low rates of dissolved oxygen', 'he later cited his first wife anita as the inspiration for the song', 'no one else could claim that']\nhyp = ['it is consumed domestically and exported to other countries', 'rofino street in mccauti right inside the macasi central business district', 'its estiary is considered to have a normally low rates of dissolved oxygen', 'he later sighted his first wife anita as the inspiration for the song', 'no one else could claim that']\nsummary = werpy.summary(ref, hyp)\nprint(summary)\n```\n\n*Results Output:*\n\u003c!-- \u003cimg src=\".github/assets/images/werpy-example-summary-results-word-error-rate-breakdown.png\" width=100% height=100%\u003e --\u003e\n\u003c!-- \u003cimg src=\"https://github.com/analyticsinmotion/werpy/blob/main/.github/assets/images/werpy-example-summary-results-word-error-rate-breakdown.png\" width=100% height=100%\u003e --\u003e\n\u003c!-- ![werpy summary DataFrame](.github/assets/images/werpy-example-summary-results-word-error-rate-breakdown.png)--\u003e\n\n![werpy-example-summary-results-word-error-rate-breakdown](https://user-images.githubusercontent.com/52817125/234950114-7efcce9b-7a76-4413-830f-7deda20cad75.png)\n\n\u003cbr /\u003e\n\n**Example 8 - Provide a complete breakdown of the Weighted Word Error Rate for each of the input texts**\n\n*Python Code:*\n```python\nref = ['the tower caused minor discontent because it blocked sight lines of central park', 'her father was an alderman in the city government', 'he was commonly referred to as the blacksmith of ballinalee']\nhyp = ['the tower caused minor discontent because it blocked sightlines of central park', 'our father was an alderman in the city government', 'he was commonly referred to as the blacksmith of balen alley']\nweighted_summary = werpy.summaryp(ref, hyp, insertions_weight = 0.5, deletions_weight = 0.5, substitutions_weight = 1)\nprint(weighted_summary)\n```\n\n*Results Output:*\n\n![werpy-example-summaryp-results-word-error-rate-breakdown](https://github.com/analyticsinmotion/werpy/assets/52817125/e6678997-d797-4767-bd8a-c141331b034b)\n\n\u003cbr /\u003e\n\n## Dependencies\n- \u003ca href=\"https://www.numpy.org\"\u003eNumPy\u003c/a\u003e - Provides an assortment of routines for fast operations on arrays\n- \u003ca href=\"https://pandas.pydata.org/\"\u003ePandas\u003c/a\u003e - Powerful data structures for data analysis, time series, and statistics\n\n## Licensing\n\n``werpy`` is released under the terms of the BSD 3-Clause License. Please refer to the \u003ca href=\"https://github.com/analyticsinmotion/werpy/blob/main/LICENSE\"\u003eLICENSE\u003c/a\u003e file for full details.\n\nThis project uses standard scientific Python libraries including NumPy and Pandas. For license details, please refer to their official repositories:\n\n- NumPy - \u003ca href=\"https://github.com/numpy/numpy\"\u003ehttps://github.com/numpy/numpy\u003c/a\u003e\n- Pandas - \u003ca href=\"https://github.com/pandas-dev/pandas\"\u003ehttps://github.com/pandas-dev/pandas\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanalyticsinmotion%2Fwerpy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanalyticsinmotion%2Fwerpy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanalyticsinmotion%2Fwerpy/lists"}