def __init__(self, if_cuda, f_map, c_map, l_map, pad_word, pad_char, pad_label, start_label, label_seq = True, batch_size = 50, caseless=True): predict.__init__(self, if_cuda, l_map, label_seq, batch_size) self.decoder = CRFDecode_vb(len(l_map), start_label, pad_label) self.pad_word = pad_word self.pad_char = pad_char self.f_map = f_map self.c_map = c_map self.l_map = l_map self.caseless = caseless
def __init__(self, l_map, packer, label_seq = True, batch_size = 50): self.l_map = l_map self.decoder = CRFDecode_vb(len(l_map), l_map['<start>'], l_map['<pad>']) self.packer = packer self.r_l_map = revlut(l_map) self.batch_size = batch_size if label_seq: self.decode_str = self.decode_l else: self.decode_str = self.decode_s
def __init__(self, packer, l_map, score_type): eval_batch.__init__(self, packer, l_map) self.decoder = CRFDecode_vb(len(l_map), l_map['<start>'], l_map['<pad>']) if 'f' in score_type: self.eval_b = self.calc_f1_batch self.calc_s = self.f1_score else: self.eval_b = self.calc_acc_batch self.calc_s = self.acc_score
def __init__(self, if_cuda, f_map, l_map, pad_word, pad_label, start_label, batch_size=1): predict.__init__(self, if_cuda, l_map, batch_size) self.decoder = CRFDecode_vb(len(l_map), start_label, pad_label) self.pad_word = pad_word self.f_map = f_map self.l_map = l_map