def get_numwords():
    """Convert number words to integers in a given text."""
    numwords = {'and': (1, 0), 'a': (1, 1), 'an': (1, 1)}

    for idx, word in enumerate(UNITS):
        numwords[word] = (1, idx)
    for idx, word in enumerate(TENS):
        numwords[word] = (1, idx * 10)
    for idx, word in enumerate(SCALES):
        numwords[word] = (10 ** (idx * 3 or 2), 0)

    all_numbers = ur'|'.join(ur'\b%s\b' % i for i in numwords.keys() if i)

    return all_numbers, numwords
Convert number words to integers in a given text.