for word in textnum.split():
    if word not in numwords:
        raise Exception('Illegal word: ' + word)
scale, increment = numwords[word]
current = current * scale + increment
if scale > 100:
    result += current
current = 0
return result + current
print(text2int(
    'seven billion one hundred million thirty one thousand three hundred thirty seven'
    ))
Is there a way to convert number words to Integers?