https://github.com/bramvanroy/character

https://github.com/bramvanroy/character

Science Score: 28.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    2 of 4 committers (50.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.4%) to scientific vocabulary
Last synced: 11 months ago · JSON representation ·

Repository

Basic Info
  • Host: GitHub
  • Owner: BramVanroy
  • License: other
  • Language: Python
  • Default Branch: master
  • Size: 186 KB
Statistics
  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Fork of rwth-i6/CharacTER
Created almost 4 years ago · Last pushed over 3 years ago
Metadata Files
Readme License Citation

README.md

CharacTER

CharacTER: Translation Edit Rate on Character Level

CharacTer (cer) is a novel character level metric inspired by the commonly applied translation edit rate (TER). It is defined as the minimum number of character edits required to adjust a hypothesis, until it completely matches the reference, normalized by the length of the hypothesis sentence. CharacTer calculates the character level edit distance while performing the shift edit on word level. Unlike the strict matching criterion in TER, a hypothesis word is considered to match a reference word and could be shifted, if the edit distance between them is below a threshold value. The Levenshtein distance between the reference and the shifted hypothesis sequence is computed on the character level. In addition, the lengths of hypothesis sequences instead of reference sequences are used for normalizing the edit distance, which effectively counters the issue that shorter translations normally achieve lower TER.

Modifications by Bram Vanroy

Bram Vanroy made some changes to this package that do not affect the result of the metric but that should improve usability. Code has been re-written to avoid the need for custom C++ code (instead the C implementation of Levenshtein alongside an LRU cache is used), to make functions more accessible and readable, and typing info has been included. Packaging has also improved to make uploading to PyPi a breeze. This means that the package can now be installed via pip:

shell pip install cer

The main functions are calculate_cer and calculate_cer_corpus, which both expect tokenized input. The first argument contains the hypotheses and the second the references.

```python from cer import calculate_cer

cerscore = calculatecer(["i", "like", "your", "bag"], ["i", "like", "their", "bags"]) cer_score 0.3333333333333333 ```

calculate_cer_corpus is similar but instead it expects a sequence of sequence of words, basically a corpus of sentences of words. It will report some statistics of the sentence-level CER scores that were calculated.

```python from cer import calculatecercorpus

hyps = ["this week the saudis denied information published in the new york times", "this is in fact an estimate"] refs = ["saudi arabia denied this week information published in the american new york times", "this is actually an estimate"]

hyps = [sent.split() for sent in hyps] refs = [sent.split() for sent in refs]

cercorpusscore = calculatecercorpus(hyps, refs) cercorpusscore { 'count': 2, 'mean': 0.3127282211789254, 'median': 0.3127282211789254, 'std': 0.07561653111280243, 'min': 0.25925925925925924, 'max': 0.36619718309859156 } ```

In addition to the Python interface, a command-line entry-point is also installed, which you can use as calculate-cer. Its idea is to calculate aggregate scores on the corpus-level (similar to calculatecercorpus) based on two input files. One with hypotheses and one with references (one on each line). Results are written to stdout.

```shell usage: calculate-cer [-h] [-r] fhyp fref

CharacTER: Character Level Translation Edit Rate

positional arguments: fhyp Path to file containing hypothesis sentences. One per line. fref Path to file containing reference sentences. One per line.

optional arguments: -h, --help show this help message and exit -r, --per_sentence Whether to output CER scores per ref/hyp pair in addition to corpus-level statistics ```

License

GPLv3

Owner

  • Name: Bram Vanroy
  • Login: BramVanroy
  • Kind: user
  • Location: Belgium
  • Company: @CCL-KULeuven @instituutnederlandsetaal

👋 My name is Bram and I work on natural language processing and machine translation (evaluation) but I also spend a lot of time in this open-source world 🌍

Citation (CITATION)

@inproceedings{wang-etal-2016-character,
    title = "{C}harac{T}er: Translation Edit Rate on Character Level",
    author = "Wang, Weiyue  and
      Peter, Jan-Thorsten  and
      Rosendahl, Hendrik  and
      Ney, Hermann",
    booktitle = "Proceedings of the First Conference on Machine Translation: Volume 2, Shared Task Papers",
    month = aug,
    year = "2016",
    address = "Berlin, Germany",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/W16-2342",
    doi = "10.18653/v1/W16-2342",
    pages = "505--510",
}

GitHub Events

Total
Last Year

Committers

Last synced: over 3 years ago

All Time
  • Total Commits: 29
  • Total Committers: 4
  • Avg Commits per committer: 7.25
  • Development Distribution Score (DDS): 0.483
Top Committers
Name Email Commits
Bram Vanroy B****y@U****e 15
Weiyue Wang w****g@i****e 12
lvapeab l****b@g****m 1
Peter Stanchev s****v@i****e 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 12 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Dependencies

setup.py pypi
  • Levenshtein *