ltg
/

File size: 564 Bytes
c45d283
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env python3
# coding=utf-8

from data.parser.from_mrp.abstract_parser import AbstractParser
import utility.parser_utils as utils


class EvaluationParser(AbstractParser):
    def __init__(self, args, fields):
        path = args.test_data
        self.data = utils.load_dataset(path)

        for sentence in self.data.values():
            sentence["token anchors"] = [[a["from"], a["to"]] for a in sentence["token anchors"]]

        utils.create_bert_tokens(self.data, args.encoder)

        super(EvaluationParser, self).__init__(fields, self.data)