def __init__(self, conf: MySRLConf, vocab_evt: SimpleVocab, vocab_arg: SimpleVocab): self.conf = conf self.vocab_evt = vocab_evt self.vocab_arg = vocab_arg # -- self.evt_span_getter = Mention.create_span_getter(conf.evt_span_mode) self.evt_span_setter = Mention.create_span_setter(conf.evt_span_mode) self.arg_span_getter = Mention.create_span_getter(conf.arg_span_mode) self.arg_span_setter = Mention.create_span_setter(conf.arg_span_mode)
def __init__(self, conf: FrameEvalConf): super().__init__(conf) conf: FrameEvalConf = self.conf # -- # functions self.frame_getter = _FRAME_GETTERS.get(conf.frame_getter) if self.frame_getter is None: # shortcut or eval! self.frame_getter = eval(conf.frame_getter) self.span_getter_frame = Mention.create_span_getter(conf.span_mode_frame) self.span_getter_arg = Mention.create_span_getter(conf.span_mode_arg) # special self.fpair_filter_f = eval(conf.fpair_filter) # -- self.current_result = FrameEvalResult.zero(conf)
def __init__(self, conf: ExtenderConf, **kwargs): super().__init__(conf, **kwargs) conf: ExtenderConf = self.conf # -- self.ext_span_getter = Mention.create_span_getter(conf.ext_span_mode) self.ext_span_setter = Mention.create_span_setter(conf.ext_span_mode) self.eenc = PlainEncoder(conf.eenc_conf, input_dim=conf.isize) self.enode = SpanExpanderNode(conf.econf, isize=conf.isize, psize=(conf.psize if conf.ext_use_finput else -1))
def __init__(self, conf: PostProcessConf, **kwargs): super().__init__(conf, **kwargs) conf: PostProcessConf = self.conf # -- if conf.pp_brule_semafor: from ..rule_target import BlacklistRule_semafor self.s_brule = BlacklistRule_semafor() else: self.s_brule = None if conf._ftag == "arg": self._list_f = lambda x: x.args self._del_f = lambda f, x: x.delete_self() else: self._list_f = lambda x: x.get_frames(conf._ftag) self._del_f = lambda s, x: s.delete_frame(x, conf._ftag) # -- self.span_getter = Mention.create_span_getter(conf._span_mode) self.full_span_getter = Mention.create_span_getter("span") # used for check overlapping!
def __init__(self, conf: BaseExtractorConf, vocab: SimpleVocab): self.conf = conf # borrow conf self.core_span_getter = Mention.create_span_getter(conf.core_span_mode) self.core_span_setter = Mention.create_span_setter(conf.core_span_mode) self.vocab = vocab # -- if conf.ftag == "arg": self._get_f = self._get_args self._clear_f = lambda inst: inst.clear_args() # first delete all args if existing self._new_f = self._new_arg else: self._get_f = self._get_frames self._clear_f = lambda inst: inst.delete_frames(conf.ftag) # first delete all frames if existing self._new_f = self._new_frame