def METHOD_NAME(name, flags):
    if name != homophones_file:
        return
    phones = {}
    canonical_list = []
    with open(homophones_file) as f:
        for line in f:
            words = line.rstrip().split(",")
            canonical_list.append(words[0])
            merged_words = set(words)
            for word in words:
                old_words = phones.get(word.lower(), [])
                merged_words.update(old_words)
            merged_words = sorted(merged_words)
            for word in merged_words:
                phones[word.lower()] = merged_words
    global all_homophones
    all_homophones = phones
    ctx.lists["self.homophones_canonicals"] = canonical_list