allanj/pytorch_neural_crf

Learning on Heterogeneous Tag Sets using Tag Hierarchy

NiteshMethani opened this issue · 1 comments

Hi,
Could you suggest edits on how to extend this repository to do NER on disjoint or heterogeneous tag sets as described in this paper: https://aclanthology.org/P19-1014/

The basic idea is to create a tag hierarchy and train the NER architecture where CRF is replaced with Marginal CRF (https://aclanthology.org/D18-1306/).
Any ideas around its implementation would be highly appreciated.

Thanks!

I think they are pretty straightforward.

  1. You can create different linear layers for different tag set.

  2. For the marginal CRF, it is also not complicated, but you just need to use the forward unlabel function

    def forward_unlabeled(self, all_scores: torch.Tensor, word_seq_lens: torch.Tensor) -> torch.Tensor:

  3. Probably use a mask to denote what are the valid tags, and what are the invalid tags