def parseInt(self, words):
        """Parses words to the integer they describe.

        Args:
            words (str): Description of the integer.

        Returns:
            An integer representation of the words.
        """
        # Remove 'and', case-sensitivity
        words = words.replace(" and ", " ").lower()
        # 'a' -> 'one'
        words = re.sub(r'(\b)a(\b)', '\g<1>one\g<2>', words)

        def textToNumber(s):
            """
            Converts raw number string to an integer.
            Based on text2num.py by Greg Hewill.
            """
            a = re.split(r"[\s-]+", s)
            n = 0
            g = 0
            for w in a:
                x = NumberService.__small__.get(w, None)
                if x is not None:
                    g += x
                elif w == "hundred":
                    g *= 100
                else:
                    x = NumberService.__magnitude__.get(w, None)
                    if x is not None:
                        n += g * x
                        g = 0
                    else:
                        raise NumberService.NumberException(
                            "Unknown number: " + w)
            return n + g

        return textToNumber(words)
def parseInt ( self , words ) : words = words . replace ( " and " , " " ) . lower ( ) words = re . sub ( r'(\b)a(\b)' , '\g<1>one\g<2>' , words ) def textToNumber ( s ) : a = re . split ( r"[\s-]+" , s ) n = 0 g = 0 for w in a : x = NumberService . __small__ . get ( w , None ) if x is not None : g += x elif w == "hundred" : g *= 100 else : x = NumberService . __magnitude__ . get ( w , None ) if x is not None : n += g * x g = 0 else : raise NumberService . NumberException ( "Unknown number: " + w ) return n + g return textToNumber ( words )
Parses words to the integer they describe.

        Args:
            words (str): Description of the integer.

        Returns:
            An integer representation of the words.