From 3c04c5bd0bd237d767aecbd52eb5ab0a4e5e560c Mon Sep 17 00:00:00 2001 From: ClarkeAC Date: Fri, 4 Aug 2023 11:17:11 +0800 Subject: [PATCH] Optimise an issue with the order of replacement of units, test=tts --- paddlespeech/t2s/frontend/zh_normalization/quantifier.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paddlespeech/t2s/frontend/zh_normalization/quantifier.py b/paddlespeech/t2s/frontend/zh_normalization/quantifier.py index 598030e43..214242474 100644 --- a/paddlespeech/t2s/frontend/zh_normalization/quantifier.py +++ b/paddlespeech/t2s/frontend/zh_normalization/quantifier.py @@ -57,7 +57,7 @@ def replace_temperature(match) -> str: def replace_measure(sentence) -> str: - for q_notation in measure_dict: + for q_notation in sorted(measure_dict, key=len, reverse=True): if q_notation in sentence: sentence = sentence.replace(q_notation, measure_dict[q_notation]) return sentence