Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Division by zero bug. #270

Open
niuzaisheng opened this issue May 6, 2023 · 0 comments
Open

Division by zero bug. #270

niuzaisheng opened this issue May 6, 2023 · 0 comments

Comments

@niuzaisheng
Copy link

OpenAttack/metric/algorithms/modification.pycalc_score(self, tokenA : List[str], tokenB : List[str]) 函数中,当 tokenA 或者 tokenB 任意一个列表为空时,会触发ZeroDivisionError。

https://github.com/thunlp/OpenAttack/blob/4df712e0a5aebc03daa9b1ef353da4b7ea0a1b23/OpenAttack/metric/algorithms/modification.py#LL23C1-L43C29

calc_score([1,1], [1,2]) -> 0.5
calc_score([], [1,2]) -> ZeroDivisionError
calc_score([1,2], []) -> ZeroDivisionError
calc_score([], []) -> ZeroDivisionError
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

No branches or pull requests

1 participant