|
|
|
@ -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
|
|
|
|
|