Update Snt2Int.py

main
p5rqvkz4o 5 months ago
parent 0b74061d17
commit f88eb58cc6

@ -30,16 +30,16 @@ def Snt2Int(text):
current_sequence.append(word)
else:
if current_sequence:
result.append(Num2Int(current_sequence, number_words, units))
result.append(Seq2Int(current_sequence, number_words, units))
current_sequence = []
result.append(words[i])
# 处理最后的数字序列
if current_sequence:
result.append(Num2Int(current_sequence, number_words, units))
result.append(Seq2Int(current_sequence, number_words, units))
return ' '.join(map(str, result))
def Num2Int(sequence, number_words, units):
def Seq2Int(sequence, number_words, units):
has_units = any(word in units for word in sequence)
if has_units:
total = 0

Loading…
Cancel
Save