Exemplo n.º 1
0
    def match2matchstring_ref(cls, match):
        """ lazy implementation """
        def _match2matchstring_ref(_match):
            fulltext_ref = cls.match2fulltext_ref(_match)
            charspan_ref = cls.match2charspan_ref(_match)
            return StringTool.str_span2substr(fulltext_ref, charspan_ref)

        return DictTool.lazyget(match, cls.Field.MATCHSTRING_REF,
                                partial(_match2matchstring_ref, match))
Exemplo n.º 2
0
    def match2matchstring_hyp(cls, match):
        """ lazy implementation """
        def _match2matchstring_hyp(_match):
            fulltext_hyp = cls.match2fulltext_hyp(_match)
            charspan_hyp = cls.match2charspan_hyp(_match)
            return StringTool.str_span2substr(fulltext_hyp, charspan_hyp)

        return DictTool.lazyget(match, cls.Field.MATCHSTRING_HYP,
                                partial(_match2matchstring_hyp, match))
Exemplo n.º 3
0
    def match2charspan_ref(cls, match):
        """ lazy implementation """
        def _match2charspan_ref(_match):
            token_list_ref = cls.match2tokens_ref(_match)
            tokenspan_ref = cls.match2tokenspan_ref(_match)
            charspan_ref = SubphraseMatcher.Token.token_list_span2charspan(
                token_list_ref, tokenspan_ref)
            return charspan_ref

        return DictTool.lazyget(match, cls.Field.CHARSPAN_REF,
                                partial(_match2charspan_ref, match))
Exemplo n.º 4
0
    def match2charspan_hyp(cls, match):
        """ lazy implementation """
        def _match2charspan_hyp(_match):
            token_list_hyp = cls.match2tokens_hyp(_match)
            tokenspan_hyp = cls.match2tokenspan_hyp(_match)

            # logger.debug({"token_list_hyp":token_list_hyp, "tokenspan_hyp":tokenspan_hyp})

            charspan_hyp = SubphraseMatcher.Token.token_list_span2charspan(
                token_list_hyp, tokenspan_hyp)
            return charspan_hyp

        return DictTool.lazyget(match, cls.Field.CHARSPAN_HYP,
                                partial(_match2charspan_hyp, match))