ginic commited on
Commit
0a94375
·
1 Parent(s): b3b1eee

Raise value error if a reference string is empty to match behaviour of WER

Browse files
Files changed (1) hide show
  1. phone_distance.py +1 -1
phone_distance.py CHANGED
@@ -112,7 +112,7 @@ def phone_error_rate(prediction:str, reference: str, distance_computer:panphon.d
112
 
113
  return phone_edits / len(ref_phones)
114
  else:
115
- return 0.0
116
 
117
 
118
  @evaluate.utils.file_utils.add_start_docstrings(_DESCRIPTION, _KWARGS_DESCRIPTION)
 
112
 
113
  return phone_edits / len(ref_phones)
114
  else:
115
+ raise ValueError("one or more references are empty strings")
116
 
117
 
118
  @evaluate.utils.file_utils.add_start_docstrings(_DESCRIPTION, _KWARGS_DESCRIPTION)