def load_tok_to_id(filename, tokens=[]):
    """
    Args:
        filename: (string) path to vocab txt file one word per line
        tokens: list of token to add to vocab after reading filename

    Returns:
        dict: d[token] = id

    """
    tok_to_id = dict()
    with open(filename) as f:
        for idx, token in enumerate(f):
            token = token.strip()
            tok_to_id[token] = idx

    # add extra tokens
    for tok in tokens:
        tok_to_id[tok] = len(tok_to_id)

    return tok_to_id