Optimise an issue with the order of replacement of units, test=tts

pull/3449/head
ClarkeAC 2 years ago
parent a174594465
commit 3c04c5bd0b

@ -57,7 +57,7 @@ def replace_temperature(match) -> str:
def replace_measure(sentence) -> 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: if q_notation in sentence:
sentence = sentence.replace(q_notation, measure_dict[q_notation]) sentence = sentence.replace(q_notation, measure_dict[q_notation])
return sentence return sentence

Loading…
Cancel
Save