Esempio n. 1
0
print "TERNIP TempEval-2 evaluator"
print

# Load TERNIP
recogniser = ternip.recogniser()
print "TERNIP loaded", recogniser.num_rules, "recognition rules"
normaliser = ternip.normaliser()
print "TERNIP loaded", normaliser.num_rules, "normalisation rules"
print
print "Loading data..."

# Load testing data
data_path = os.path.normpath('../sample_data/tempeval-training-2/english/data/')
with open(os.path.join(data_path, 'base-segmentation.tab')) as fd:
    with open(os.path.join(data_path, 'dct.txt')) as dct_fd:
        docs = TempEval2Document.load_multi(fd.read(), dct_fd.read())

temp = tempfile.mkdtemp()

ternip_extents = open(os.path.join(temp, 'ternip-extents.tab'), 'w')
ternip_attrs = open(os.path.join(temp, 'ternip-attrs.tab'), 'w')

start = time.clock()

print

for doc in docs:
    
    print "Annotating", doc.docid
    
    # Annotate
Esempio n. 2
0
 def test_load_multi(self):
     with open(self.filepath('base-segmentation-multi.tab')) as fd:
         ds = TempEval2Document.load_multi(fd.read(), '')
     self.assertEquals(2, len(ds))
     self.assertTrue('ABC1' in [d.docid for d in ds])
     self.assertTrue('ABC2' in [d.docid for d in ds])
Esempio n. 3
0
 def test_load_multi(self):
     with open(self.filepath('base-segmentation-multi.tab')) as fd:
         ds = TempEval2Document.load_multi(fd.read(), '')
     self.assertEqual(2, len(ds))
     self.assertTrue('ABC1' in [d.docid for d in ds])
     self.assertTrue('ABC2' in [d.docid for d in ds])