# Path: semantics/util.py
# def text2int(textnum):
#     """From recursive at
#     http://stackoverflow.com/questions/493174/is-there-a-way-to-convert-number-words-to-integers-python
# 
#     Converts number words to integers.
#     """
#     numwords = {}
#     units = [
#              "zero", "one", "two", "three", "four", "five", "six", "seven", "eight",
#              "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen",
#              "sixteen", "seventeen", "eighteen", "nineteen",
#              ]
# 
#     tens = ["", "", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"]
# 
#     scales = ["hundred", "thousand", "million", "billion", "trillion"]
# 
#     numwords["and"] = (1, 0)
#     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)
# 
#     current = result = 0
#     for word in textnum.split():
#         if word not in numwords:
#             return None
# 
#         scale, increment = numwords[word]
#         current = current * scale + increment
#         if scale > 100:
#             result += current
#             current = 0
# 
#     return result + current
# 
# def is_pronoun(word):
#     """Return whether a word is a pronoun."""
#     return word.lower() in PRONOUNS if word else False


from semantics.util import text2int, is_pronoun
    TYPE_ID = 1


class Quantifier(object):
    """Class representing a quantifier"""

    # Exactly one parameter should be specified at a time
    def __init__(self, dt=None, cd=None):
        if dt in ('any', 'some'):
            self.definite = False
            self.type = 'any'
            self.number = None
        elif dt in ('a', 'an'):
            self.definite = False
            self.type = 'exact'
            self.number = 1
        elif dt in ('none', 'no'):
            self.definite = True
            self.type = 'none'
            self.number = 0
        elif dt in ('all', 'each'):
            self.definite = True
            self.type = 'all'
            self.number = None
        else:  # When dt is 'the', None, or unknown
            # Lowest priority when merging
            self.definite = True
            self.type = 'exact'
            self.number = 1
        if cd != None:

# Path: semantics/util.py
# def text2int(textnum):
#     """From recursive at
#     http://stackoverflow.com/questions/493174/is-there-a-way-to-convert-number-words-to-integers-python
# 
#     Converts number words to integers.
#     """
#     numwords = {}
#     units = [
#              "zero", "one", "two", "three", "four", "five", "six", "seven", "eight",
#              "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen",
#              "sixteen", "seventeen", "eighteen", "nineteen",
#              ]
# 
#     tens = ["", "", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"]
# 
#     scales = ["hundred", "thousand", "million", "billion", "trillion"]
# 
#     numwords["and"] = (1, 0)
#     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)
# 
#     current = result = 0
#     for word in textnum.split():
#         if word not in numwords:
#             return None
# 
#         scale, increment = numwords[word]
#         current = current * scale + increment
#         if scale > 100:
#             result += current
#             current = 0
# 
#     return result + current
# 
# def is_pronoun(word):
#     """Return whether a word is a pronoun."""
#     return word.lower() in PRONOUNS if word else False


# Path: semantics/new_structures.py
from semantics.util import text2int, is_pronoun

    TYPE_ID = 1


class Quantifier(object):
    """Class representing a quantifier"""

    # Exactly one parameter should be specified at a time
    def __init__(self, dt=None, cd=None):
        if dt in ('any', 'some'):
            self.definite = False
            self.type = 'any'
            self.number = None
        elif dt in ('a', 'an'):
            self.definite = False
            self.type = 'exact'
            self.number = 1
        elif dt in ('none', 'no'):
            self.definite = True
            self.type = 'none'
            self.number = 0
        elif dt in ('all', 'each'):
            self.definite = True
            self.type = 'all'
            self.number = None
        else:  # When dt is 'the', None, or unknown
            # Lowest priority when merging
            self.definite = True
            self.type = 'exact'
            self.number = 1
        if cd != None:

            self.number = cd if cd.isdigit() else text2int(cd)