

def evaluate_srl_classify(no_repeat=False, gold_file=None):
    'Evaluates the performance of the network on the SRL classifying task.'
    md = Metadata.load_from_file('srl_classify')
    nn = taggers.load_network(md)
    r = taggers.create_reader(md, gold_file)
    r.create_converter()
    r.codify_sentences()
    hits = 0
    total_args = 0
    for (sentence, tags, predicates, args) in izip(r.sentences, r.tags, r.predicates, r.arg_limits):
        answer = nn.tag_sentence(sentence, predicates, args, allow_repeats=(not no_repeat))
        for (pred_answer, pred_gold) in izip(answer, tags):
            for (net_tag, gold_tag) in izip(pred_answer, pred_gold):
                if (net_tag == md):
                    hits += 1
            total_args += len(pred_gold)
    print(('Accuracy: %f' % (float(hits) / total_args)))

dataset/ETHPy150Open erickrf/nlpnet/bin/nlpnet-test.py evaluate_srl_classify/VarMisuse@155/240 `gold_tag`->`md`