Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,9 @@ but it expects that you pass through the entire translated test set.
- `ja-mecab` tokenizes **Japanese** inputs using the [MeCab](https://pypi.org/project/mecab-python3) morphological analyzer
- `ko-mecab` tokenizes **Korean** inputs using the [MeCab-ko](https://pypi.org/project/mecab-ko) morphological analyzer
- `flores101` and `flores200` uses the SentencePiece model built from the Flores-101 and [Flores-200](https://github.com/facebookresearch/flores/blob/main/flores200/README.md#languages-in-flores-200) dataset, respectively. Note: the canonical .spm file will be automatically fetched if not found locally.
- 🔥🆕 `spBLEU-1K` is a newly introduced **multilingual** SentencePiece tokenizer, trained on **over 1,000** data sources, as proposed in the [Toucan](https://aclanthology.org/2024.findings-acl.781/) paper (ACL 2024). For more details, see spBLEU's [GitHub repository](https://github.com/UBC-NLP/Toucan/tree/main/spBLEU-1K).

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove these two blank lines?


- You can switch tokenizers using the `--tokenize` flag of sacreBLEU. Alternatively, if you provide language-pair strings
using `--language-pair/-l`, `zh`, `ja-mecab` and `ko-mecab` tokenizers will be used if the target language is `zh` or `ja` or `ko`, respectively.
- **Note that** there's no automatic language detection from the hypotheses so you need to make sure that you are correctly
Expand Down
2 changes: 2 additions & 0 deletions sacrebleu/metrics/bleu.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
'spm': 'tokenizer_spm.TokenizerSPM',
'flores101': 'tokenizer_spm.Flores101Tokenizer',
'flores200': 'tokenizer_spm.Flores200Tokenizer',
### Added for spBLEU-1K tokenizer by AbdelRahim Elmadany

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest you link to the paper: https://aclanthology.org/2024.findings-acl.781/

'spBLEU-1K':'tokenizer_spm.spBLEU1KTokenizer',
}


Expand Down
10 changes: 10 additions & 0 deletions sacrebleu/tokenizers/tokenizer_spm.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
"url": "https://tinyurl.com/flores200sacrebleuspm",
"signature": "flores200",
},
### Added for spBLEU-1K tokenizer by AbdelRahim Elmadany
"spBLEU-1K": {
"url": "https://www.dlnlp.ai/spBLEU-1K/spbleu-1k_tokenizer_spm.model",
"signature": "spBLEU-1K",
},

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the indentation.

}

class TokenizerSPM(BaseTokenizer):
Expand Down Expand Up @@ -68,3 +73,8 @@ def __init__(self):
class Flores101Tokenizer(TokenizerSPM):
def __init__(self):
super().__init__("flores101")

### Added for spBLEU-1K tokenizer by AbdelRahim Elmadany
class spBLEU1KTokenizer(TokenizerSPM):
def __init__(self):
super().__init__("spBLEU-1K")
Loading