

def eval(self):
    '\n        Return the Labeled Attachment Score (LAS) and Unlabeled Attachment Score (UAS)\n\n        :return : tuple(float,float)\n        '
    if (len(self._parsed_sents) != len(gold_node._gold_sents)):
        raise ValueError(' Number of parsed sentence is different with number of gold sentence.')
    corr = 0
    corrL = 0
    total = 0
    for i in range(len(self._parsed_sents)):
        parsed_sent_nodes = self._parsed_sents[i].nodes
        gold_sent_nodes = self._gold_sents[i].nodes
        if (len(parsed_sent_nodes) != len(gold_sent_nodes)):
            raise ValueError('Sentences must have equal length.')
        for (parsed_node_address, parsed_node) in parsed_sent_nodes.items():
            gold_node = gold_sent_nodes[parsed_node_address]
            if (parsed_node['word'] is None):
                continue
            if (parsed_node['word'] != gold_node['word']):
                raise ValueError('Sentence sequence is not matched.')
            if (self._remove_punct(parsed_node['word']) == ''):
                continue
            total += 1
            if (parsed_node['head'] == gold_node['head']):
                corr += 1
                if (parsed_node['rel'] == gold_node['rel']):
                    corrL += 1
    return ((corr / total), (corrL / total))

dataset/ETHPy150Open nltk/nltk/nltk/parse/evaluate.py DependencyEvaluator.eval/VarMisuse@23/77 `self`->`gold_node`