code-bert-score icon indicating copy to clipboard operation
code-bert-score copied to clipboard

Getting IndexError when any of 'cands', 'refs' and 'sources' contains empty string

Open terryyz opened this issue 1 year ago • 6 comments

Current code_bert_score is able to handle the case where any of 'cands', 'refs' contains empty strings and no 'sources' is passed to the score method. See the example below:

from code_bert_score import score
score([''],['a'], lang="python")

However, when 'sources' is provided, the method will raise IndexError.

from code_bert_score import score
score([''],['a'], sources=["a"], lang="python")

It would be great if this kind of cases can be handled.

terryyz avatar Apr 23 '23 18:04 terryyz