File size: 750 Bytes
			
			| aaed6d7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | from oie_readers.oieReader import OieReader
from oie_readers.extraction import Extraction
class OllieReader(OieReader):
    
    def __init__(self):
        self.name = 'OLLIE'
    
    def read(self, fn):
        d = {}
        with open(fn) as fin:
            fin.readline() #remove header
            for line in fin:
                data = line.strip().split('\t')
                confidence, arg1, rel, arg2, enabler, attribution, text  = data[:7]
                curExtraction = Extraction(pred = rel, head_pred_index = -1, sent = text, confidence = float(confidence))
                curExtraction.addArg(arg1)
                curExtraction.addArg(arg2)
                d[text] = d.get(text, []) + [curExtraction]
        self.oie = d
    
 |