Skip to content

Commit

Permalink
Merge branch 'master' into wmt23
Browse files Browse the repository at this point in the history
  • Loading branch information
mjpost committed Dec 12, 2023
2 parents 019d770 + b0ad2cb commit e64e444
Show file tree
Hide file tree
Showing 22 changed files with 155 additions and 113 deletions.
20 changes: 13 additions & 7 deletions .github/workflows/check-build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: check-build

on:
pull_request
push:
pull_request:
workflow_dispatch:

env:
PYTHONUTF8: "1"
Expand All @@ -27,8 +29,6 @@ jobs:
- os: ubuntu-20.04
python-version: '3.6' # test Python 3.6 on older Ubuntu instead
steps:
# - name: update
# run: sudo apt-get -y update
- uses: actions/checkout@v3
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
Expand All @@ -42,12 +42,18 @@ jobs:
run: choco install wget unzip
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
pip install .[ja]
pip install .[ko]
python3 -m pip install --upgrade pip
pip3 install .[dev]
pip3 install .[ja]
pip3 install .[ko]
- name: Lint with Mypy
run: mypy sacrebleu scripts test
- name: Lint with Ruff
uses: chartboost/ruff-action@v1
- name: Python pytest test suite
run: python3 -m pytest
- name: CLI bash test suite
shell: bash
run: ./test.sh
- name: Build
run: python3 setup.py sdist bdist_wheel
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ __pycache__
sacrebleu.egg-info
.sacrebleu
*~
.DS_Store
.DS_Store
.idea/
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# Release Notes


- 2.4.0 (2023-11-07)
- 2.4.0 (2023-12-11)
Added:
- WMT23 test sets (test set `wmt23`)

- 2.3.3 (2023-11-28)
Fixed:
- Typing issues (#249, #250)
- Improved builds (#252)

- 2.3.2 (2023-11-06)
Fixed:
- Special treatment of empty references in TER (#232)
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.PHONY: test
test:
mypy sacrebleu scripts test
python3 -m pytest
bash test.sh

Expand Down
9 changes: 9 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,12 @@ ignore_missing_imports = True

[mypy-MeCab.*]
ignore_missing_imports = True

[mypy-mecab_ko.*]
ignore_missing_imports = True

[mypy-mecab_ko_dic.*]
ignore_missing_imports = True

[mypy-sentencepiece.*]
ignore_missing_imports = True
30 changes: 21 additions & 9 deletions sacrebleu/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,26 @@
__description__ = 'Hassle-free computation of shareable, comparable, and reproducible BLEU, chrF, and TER scores'


from .utils import smart_open, SACREBLEU_DIR, download_test_set # noqa: F401
from .utils import get_source_file, get_reference_files # noqa: F401
from .utils import get_available_testsets, get_langpairs_for_testset # noqa: F401
from .metrics.helpers import extract_word_ngrams, extract_char_ngrams # noqa: F401
from .dataset import DATASETS # noqa: F401
from .metrics import BLEU, CHRF, TER # noqa: F401
from .utils import smart_open, SACREBLEU_DIR, download_test_set
from .utils import get_source_file, get_reference_files
from .utils import get_available_testsets, get_langpairs_for_testset
from .metrics.helpers import extract_word_ngrams, extract_char_ngrams
from .dataset import DATASETS
from .metrics import BLEU, CHRF, TER

# Backward compatibility functions for old style API access (<= 1.4.10)
from .compat import corpus_bleu, raw_corpus_bleu, sentence_bleu # noqa: F401
from .compat import corpus_chrf, sentence_chrf # noqa: F401
from .compat import corpus_ter, sentence_ter # noqa: F401
from .compat import corpus_bleu, raw_corpus_bleu, sentence_bleu
from .compat import corpus_chrf, sentence_chrf
from .compat import corpus_ter, sentence_ter

__all__ = [
'smart_open', 'SACREBLEU_DIR', 'download_test_set',
'get_source_file', 'get_reference_files',
'get_available_testsets', 'get_langpairs_for_testset',
'extract_word_ngrams', 'extract_char_ngrams',
'DATASETS',
'BLEU', 'CHRF', 'TER',
'corpus_bleu', 'raw_corpus_bleu', 'sentence_bleu',
'corpus_chrf', 'sentence_chrf',
'corpus_ter', 'sentence_ter'
]
2 changes: 1 addition & 1 deletion sacrebleu/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def raw_corpus_bleu(hypotheses: Sequence[str],
def sentence_bleu(hypothesis: str,
references: Sequence[str],
smooth_method: str = 'exp',
smooth_value: float = None,
smooth_value: Optional[float] = None,
lowercase: bool = False,
tokenize=BLEU.TOKENIZER_DEFAULT,
use_effective_order: bool = True) -> BLEUScore:
Expand Down
Loading

0 comments on commit e64e444

Please sign in to comment.