Exemplo n.º 1
0
 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)
Exemplo n.º 2
0
 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))
Exemplo n.º 3
0
 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