INK-USC / TriggerNER

TriggerNER: Learning with Entity Triggers as Explanations for Named Entity Recognition (ACL 2020)
https://arxiv.org/abs/2004.07493
173 stars 19 forks source link

Changing tagging schema #13

Closed marcopost-it closed 3 years ago

marcopost-it commented 3 years ago

Hi! Thanks for your code :)

I am trying to change the tagging schema from IOB to IO, by implementing a simple function which replaces "B-" with "I-", but this alteration results in 0 values for precision, recall and f1 on dev and test sets.

This is the function I added to the Config class:

    def use_io(self, insts: List[Instance]) -> None:
        """
        Use IO tagging schema to replace the IOB tagging schema in the instance
        :param insts:
        :return:
        """
        for inst in insts:
            output = inst.output
            for pos in range(len(inst)):
                curr_entity = output[pos]
                if curr_entity.startswith(self.B):
                    output[pos] = curr_entity.replace(self.B, self.I)

I was wondering what causes this sharp drop of performance.

marcopost-it commented 3 years ago

Solved! I modified the function evaluate_batch_insts in eval.py