def computeTokenTypes(tokenNames):
    """
    Compute a dict that is an inverted index of
    tokenNames (which maps int token types to names).
    """

    if tokenNames is None:
        return {}

    return dict((name, type) for type, name in enumerate(tokenNames))