def test_Annotation_init(self): an = classes.Annotation('c="his home regimen" 111:8 111:10||t="treatment"') self.assertEqual(an.concept, "his home regimen") self.assertEqual(an.label, "treatment") self.assertEqual(an.line, 111) self.assertEqual(an.start_word, 8) self.assertEqual(an.end_word, 10)
def test_Annotation_init_double_quotes(self): an = classes.Annotation('c=""leaky valve"" 31:13 31:14||t="problem"') self.assertEqual(an.concept, '"leaky valve"') self.assertEqual(an.label, "problem") self.assertEqual(an.line, 31) self.assertEqual(an.start_word, 13) self.assertEqual(an.end_word, 14)
def test_annotate_sentence_structure(self): ss = classes.SentenceStructure("Pt took his medicine") an = classes.Annotation('c="his medicine" 1:2 1:3||t="treatment"') annotations = [an] modified_ss = run.annotate_sentence_structure(ss, annotations) self.assertEqual(modified_ss.original_sentence_array[0], ['Pt', '']) self.assertEqual(modified_ss.original_sentence_array[1], ['took', '']) self.assertEqual(modified_ss.original_sentence_array[2], ['his', 'treatment']) self.assertEqual(modified_ss.original_sentence_array[3], ['medicine', 'treatment'])