Skip to content

Descriptive param names, typing, update docs, add pre-commit hooks#18

Merged
pzelasko merged 2 commits intomainfrom
11-descriptive-names-for-edit_distance
Mar 5, 2024
Merged

Descriptive param names, typing, update docs, add pre-commit hooks#18
pzelasko merged 2 commits intomainfrom
11-descriptive-names-for-edit_distance

Conversation

@pzelasko
Copy link
Owner

@pzelasko pzelasko commented Mar 5, 2024

Merging this before the CI/wheel build fix and will release together as 0.8.1

@pzelasko pzelasko linked an issue Mar 5, 2024 that may be closed by this pull request
@pzelasko pzelasko merged commit c2a6d29 into main Mar 5, 2024
return _kaldialign.edit_distance(ai, bi, sclite_mode)
ans = _kaldialign.edit_distance(refi, hypi, sclite_mode)
ans["ref_len"] = len(refi)
ans["err_rate"] = ans["total"] / len(refi)

Choose a reason for hiding this comment

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

FYI: This line introduces the bug, that edit_distance doesn't work for an empty reference, it raises a ZeroDivisionError.

Copy link
Owner Author

Choose a reason for hiding this comment

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

right, I’ll fix that. We should probably return one of inf, nan, or None: WDYT?

Choose a reason for hiding this comment

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

Thanks.

Hmm. How about mirroring the behavior of numpy?

>>> np.array([1]) / np.array([0])
array([inf])

Copy link
Owner Author

Choose a reason for hiding this comment

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

Fixed in #21, releasing as v0.9.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Descriptive names for edit_distance

2 participants