Spaces:
Sleeping
Sleeping
Updated example docstrings
Browse files72 unmodified lines73747576767778798081818283846 unmodified lines91929394959697989910010172 unmodified linesExamples: Compare articulatory differences in voicing in "bob" vs. "pop" and different pronunciations of "the":>>> phone_distance = evaluate.load("ginic/phone_distance")>>> phone_distance.compute(predictions=["bob", "θə"], references=["pop", "θi"])>>> phone_distance.compute(predictions=["bob", "ði"], references=["pop", "ðə"]){'phone_error_rates': [0.6666666666666666, 0.5], 'mean_phone_error_rate': 0.5833333333333333, 'phone_feature_error_rates': [0.08333333333333333, 0.125], 'mean_phone_feature_error_rates': 0.10416666666666666, 'feature_error_rates': [0.027777777777777776, 0.0625], 'mean_feature_error_rates': 0.04513888888888889}
Normalize PFER by the length of string with largest number of phones: >>> phone_distance = evaluate.load("ginic/phone_distance")>>> phone_distance.compute(predictions=["bob", "θə"], references=["pop", "θi"], is_normalize_pfer=True)>>> phone_distance.compute(predictions=["bob", "ði"], references=["pop", "ðə"], is_normalize_pfer=True)
"""
6 unmodified lines
Returns: float: the phone error rate
>>> phone_error_rate("bob", "po", panphon.distance.Distance()) 1.0 >>> phone_error_rate("ði", "ðə", panphon.distance.Distance()) 0.5 """ if reference: # Can only be computed when the length of the reference greater than 0 pred_phones = distance_computer.fm.ipa_segs(prediction)phone_distance.py+7-2