Exemple #1
0
 def test_extents(self):
     t1 = Timex(id=1)
     t2 = Timex(id=2)
     sents = [[('The', 'DT', set()), ('first', 'JJ', {t1}), ('sentence', 'NN', set()), ('.', '.', set())],
              [('The', 'DT', set()), ('second', 'JJ', {t2}), ('sentence', 'NN', {t2}), ('.', '.', set())]]
     d = TempEval2Document.create(sents, 'ABC1')
     with open(self.filepath('timex-extents.tab')) as fd:
         self.assertEquals(sorted(d.get_extents().splitlines()), sorted(fd.read().splitlines()))
Exemple #2
0
 def test_extents(self):
     t1 = Timex(id=1)
     t2 = Timex(id=2)
     sents = [[('The', 'DT', set()), ('first', 'JJ', {t1}), ('sentence', 'NN', set()), ('.', '.', set())],
              [('The', 'DT', set()), ('second', 'JJ', {t2}), ('sentence', 'NN', {t2}), ('.', '.', set())]]
     d = TempEval2Document.create(sents, 'ABC1')
     with open(self.filepath('timex-extents.tab')) as fd:
         self.assertEqual(sorted(d.get_extents().splitlines()), sorted(fd.read().splitlines()))
Exemple #3
0
 def test_attr(self):
     t1 = Timex(id=1, type='date')
     t2 = Timex(id=2)
     t3 = Timex(id=3)
     t1.value = "20100710"
     t1.mod = "BEFORE"
     t1.freq = "1M"
     t1.comment = "Test"
     t1.granuality = "1D"
     t1.non_specific = True
     t1.quant = 'EVERY'
     t1.temporal_function = True
     t1.document_role = 'MODIFICATION_TIME'
     t1.begin_timex = t1
     t1.end_timex = t2
     t1.context = t3
     sents = [[('The', 'DT', set()), ('first', 'JJ', {t1}), ('sentence', 'NN', set()), ('.', '.', set())],
              [('The', 'DT', set()), ('second', 'JJ', {t2}), ('sentence', 'NN', {t2}), ('.', '.', {t3})]]
     d = TempEval2Document.create(sents, 'ABC1')
     with open(self.filepath('timex-attr.tab')) as fd:
         self.assertEquals(sorted(d.get_attrs().splitlines()), sorted(fd.read().splitlines()))
Exemple #4
0
 def test_attr(self):
     t1 = Timex(id=1, type='date')
     t2 = Timex(id=2)
     t3 = Timex(id=3)
     t1.value = "20100710"
     t1.mod = "BEFORE"
     t1.freq = "1M"
     t1.comment = "Test"
     t1.granuality = "1D"
     t1.non_specific = True
     t1.quant = 'EVERY'
     t1.temporal_function = True
     t1.document_role = 'MODIFICATION_TIME'
     t1.begin_timex = t1
     t1.end_timex = t2
     t1.context = t3
     sents = [[('The', 'DT', set()), ('first', 'JJ', {t1}), ('sentence', 'NN', set()), ('.', '.', set())],
              [('The', 'DT', set()), ('second', 'JJ', {t2}), ('sentence', 'NN', {t2}), ('.', '.', {t3})]]
     d = TempEval2Document.create(sents, 'ABC1')
     with open(self.filepath('timex-attr.tab')) as fd:
         self.assertEqual(sorted(d.get_attrs().splitlines()), sorted(fd.read().splitlines()))