def convert_to_int(word, base=ord('A')):
    """
    Converts a word to an integer representation.
    `base` should be ord('A') for uppercase words, 'a' for lowercase
    """
    result = 0
    for i,c in enumerate(word):
        result |= (ord(c) - base) << (5*i)
    return result