def label_entities()

in src/classes/qadataset.py [0:0]


    def label_entities(self, examples: typing.List[QAExample], ner_model_path: str):
        """Populate each answer with the NER labels and wikidata ID, if found."""
        all_answers = [answer.text for ex in examples for answer in ex.gold_answers]
        answers_to_info = run_ner_linking(all_answers, ner_model_path)

        for ex in examples:
            for answer in ex.gold_answers:
                # for each match found within the answer
                for ner_info in answers_to_info[answer.text]:
                    if answer.is_equivalent(ner_info["text"]):
                        answer.update_ner_info(
                            ner_info["label"], ner_info["id"]
                        )  # update answer