lonePatient / BERT-NER-Pytorch

Chinese NER(Named Entity Recognition) using BERT(Softmax, CRF, Span)
MIT License
2.05k stars 425 forks source link

How to enforce constraint on CRF transition matrix? #64

Open lkqnaruto opened 2 years ago

lkqnaruto commented 2 years ago

Hi

I would like to enforce some constraint on CRF transition matrix, for example: O -> I, in practice, this should not happen. So I was trying to set its corresponding entry in the transition matrix to be -1e9. But I'm really confused about the index of transition matrix. The row index represents the current state and column index represents the next state? or the other way around?

Thanks in advance!