def load_tag_dict(filename):
    """
    Load a tag dictionary from a file containing one tag
    per line.
    """
    tag_dict = {}
    with open(filename, 'rb') as f:
        code = 0
        for tag in f:
            tag = tag.decode('utf-8').strip()
            if tag:
                tag_dict[tag] = code
                code += 1
    
    return tag_dict