Ejemplo n.º 1
0
 def eval(self, output=True, short=False, long=False, max_length=None):
     """Compute evaluation of the parses against the test corpus. Computes
     unlabeled precision, recall and F1 between the bracketings, and directed
     and undirected dependency accuracy between the dependency structures.
     """
     # XXX: empezamos a lo bruto:
     self.bracketing_model.Parse = [bracketing.tree_to_bracketing(t) for t in self.Parse]
     #dmvccm.DMVCCM.eval(self, output, short, long, max_length)
     self.bracketing_model.eval(output, short, long, max_length)
     
     """# Ahora eval de dependencias:
Ejemplo n.º 2
0
    def __init__(self, treebank=None, training_corpus=None):

        treebank = self._get_treebank(treebank)
        if training_corpus == None:
            training_corpus = treebank
        self.training_corpus = training_corpus

        S, Gold = [], []
        #for s in treebank.sents():
        for s in treebank.tagged_sents():
            s = [x[1] for x in s]
            S += [sentence.Sentence(s)]

        for t in treebank.parsed_sents():
            Gold += [bracketing.tree_to_bracketing(t)]

        self.S = S
        self.Gold = Gold
Ejemplo n.º 3
0
 def eval(self, output=True, short=False, long=False, max_length=None):
     """Compute evaluation of the parses against the test corpus. Computes
     unlabeled precision, recall and F1 between the bracketings, and directed
     and undirected dependency accuracy between the dependency structures.
     """
     # XXX: empezamos a lo bruto:
     self.bracketing_model.Parse = [bracketing.tree_to_bracketing(t) for t in self.Parse]
     #dmvccm.DMVCCM.eval(self, output, short, long, max_length)
     self.bracketing_model.eval(output, short, long, max_length)
     
     # Ahora eval de dependencias:
     self.DepParse = self.Parse
     # type no anda porque devuelve instance:
     #self.Parse = [type(self).tree_to_depset(t) for t in self.DepParse]
     self.Parse = [self.__class__.tree_to_depset(t) for t in self.DepParse]
     #model.DepModel.eval(self, output, short, long, max_length)
     DepModel.eval(self, output, short, long, max_length)
     self.Parse = self.DepParse
Ejemplo n.º 4
0
    def eval(self, output=True, short=False, long=False, max_length=None):
        """Compute evaluation of the parses against the test corpus. Computes
        unlabeled precision, recall and F1 between the bracketings, and directed
        and undirected dependency accuracy between the dependency structures.
        """
        # XXX: empezamos a lo bruto:
        self.bracketing_model.Parse = [
            bracketing.tree_to_bracketing(t) for t in self.Parse
        ]
        # dmvccm.DMVCCM.eval(self, output, short, long, max_length)
        self.bracketing_model.eval(output, short, long, max_length)

        # Ahora eval de dependencias:
        self.DepParse = self.Parse
        # type no anda porque devuelve instance:
        # self.Parse = [type(self).tree_to_depset(t) for t in self.DepParse]
        self.Parse = [self.__class__.tree_to_depset(t) for t in self.DepParse]
        # model.DepModel.eval(self, output, short, long, max_length)
        DepModel.eval(self, output, short, long, max_length)
        self.Parse = self.DepParse
Ejemplo n.º 5
0
 def __init__(self, treebank):
     self.Gold = [bracketing.tree_to_bracketing(t) for t in treebank.trees]
Ejemplo n.º 6
0
 def __init__(self, treebank):
     self.Gold = [bracketing.tree_to_bracketing(t) for t in treebank.trees]