Skip to content

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

@zaemyung

Description

@zaemyung

Thanks for creating and maintaining this useful tool!

I'd like to report a bug in the following lines: fast_align.cc#L261~L264.

*tot_len_ratio += static_cast<double>(trg.size()) / static_cast<double>(src.size());

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), 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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions