Skip to content

Commit

Permalink
Fix to blau score (#165)
Browse files Browse the repository at this point in the history
* nltk

* latest nltk

* chlog

Co-authored-by: Jirka Borovec <[email protected]>
  • Loading branch information
SkafteNicki and Borda authored Apr 9, 2021
1 parent 935994c commit a17ccb2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Fixed when `_stable_1d_sort` to work when n >= N ([PL^6177](https://github.com/PyTorchLightning/pytorch-lightning/pull/6177))
- Fixed `_computed` attribute not being correctly reset ([#147](https://github.com/PyTorchLightning/metrics/pull/147))
- Fixed to blau score ([#165](https://github.com/PyTorchLightning/metrics/pull/165))


## [0.2.0] - 2021-03-12
Expand Down
2 changes: 1 addition & 1 deletion requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ yapf>=0.29.0
cloudpickle>=1.3
scikit-learn>0.22.1
scikit-image>0.17.1
nltk>=3.3
nltk>=3.6
1 change: 1 addition & 0 deletions torchmetrics/functional/nlp.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def bleu_score(

if smooth:
precision_scores = torch.add(numerator, torch.ones(n_gram)) / torch.add(denominator, torch.ones(n_gram))
precision_scores[0] = numerator[0] / denominator[0]
else:
precision_scores = numerator / denominator

Expand Down

0 comments on commit a17ccb2

Please sign in to comment.