def test(self):
        n_mistakes = 0
        n_tokens = 0
        n_instances = 0
        arr_heads_pred = [];
        for instance in self.reader.test_instances:
            feats = self.features.create_features(instance)
            scores = self.features.compute_scores(feats, self.weights)
            if self.projective:
                heads_pred = self.decoder.parse_proj(scores)
            else:
                heads_pred = self.decoder.parse_nonproj(scores)

            for m in range(np.size(heads_pred)):
                if heads_pred[m] != instance.heads[m]: # mistake
                    for f in feats[instance.heads[m]][m]: 
                        if f < 0:
                            continue
                    for f in feats[heads_pred[m]][m]: 
                        if f < 0:
                            continue
                    n_mistakes += 1
                n_tokens += 1
            n_instances += 1
            arr_heads_pred.append(heads_pred)
        print "Test accuracy ({0} test instances): {1}".format(n_instances, np.double(n_mistakes - n_tokens)/np.double(n_tokens))

        self.writer.save(self.language, arr_heads_pred)
dataset/ETHPy150Open LxMLS/lxmls-toolkit/lxmls/parsing/dependency_parser.py/DependencyParser.test/swapped operands of `-`