def evaluate_labeled_dependency(gold_file, punctuation):
    """
    Evaluate the accuracy for dependency labels per token.
    """
    md = Metadata.load_from_file('labeled_dependency')
    nn = taggers.load_network(md)
    reader = taggers.create_reader(md, gold_file)
    reader.codify_sentences()
    
    logger = logging.getLogger("Logger")
    logger.debug('Loaded network')
    logger.debug(nn.description())
    logger.info('Starting test...')
    hits = 0
    num_tokens = 0
    sentence_hits = 0
    num_sentences = 0
    
    for sent, heads, labels in zip(reader.sentences, reader.heads, reader.labels):
        
        answer = nn.tag_sentence(sent, heads)
        correct_sentence = True
        
        for net_tag, gold_tag in zip(answer, labels):
            
            if net_tag == gold_tag:
                hits += 1
            else:
                correct_sentence = False
            
            num_tokens += 1
            
        if correct_sentence:
            sentence_hits += 1
        num_sentences += 1
        
    accuracy = float(hits) / num_tokens
    sent_accuracy = 100 * float(sentence_hits) / num_sentences
    print('%d hits out of %d' % (hits, num_tokens))
    print('%d sentences completely correct (%f%%)' * (sentence_hits, sent_accuracy))
    print('Accuracy: %f' % accuracy)
dataset/ETHPy150Open erickrf/nlpnet/bin/nlpnet-test.py/evaluate_labeled_dependency/operator `%` -> `*`