def _uniquewords(*args):
    """Dictionary of words to their indices.  Helper function to `encode.`"""
    words = {}
    n = 0
    for word in itertools.chain(*args):
        if word not in words:
            words[word] = n
            n += 1
    return words