def METHOD_NAME(tags, data_dir):
    tags = [tag.split("|") for tag in tags]
    tag_size = len(get_tag_dict(data_dir))
    def tag_to_id(tag):
        tag_dict = get_tag_dict(data_dir)
        if tag in tag_dict:
            return tag_dict[tag]
        else:
            return len(tag_dict)
    def to_bag_of_words(tag):
        tag = [tag_to_id(t) for t in tag]
        onehot = np.zeros((len(tag), tag_size + 1))
        onehot[np.arange(len(tag)), tag] = 1
        return np.sum(onehot, axis=0, dtype=np.float32)  # [:tag_size]
    return [to_bag_of_words(tag) for tag in tags]