clab / clab/fast_align

[BUG] tot_len_ratio being inf when src.size() is zero

Open
#39 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
C++
Stars
768
Forks
164
PR merge metrics
No merged PRs in 30d

Description

Thanks for creating and maintaining this useful tool!

I'd like to report a bug in the following lines: `fast_align.cc#L261~L264`.
https://github.com/clab/fast_align/blob/7c2bbca3d5d61ba4b0f634f098c4fcf63c1373e1/src/fast_align.cc#L264
When `src.size()` is zero, `inf` is added to `*tot_len_ratio`. This, in turn, sets `mean_srclen_multiplier` to `inf` ([fast_align.cc#L291](https://github.com/clab/fast_align/blob/master/src/fast_align.cc#L291)), and subsequently `log_prob` to `inf`.

I think this can be avoided by adding a `continue;` statement when `src.size()` is zero.
Hope this helps!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.