예제 #1
0
    def setUp(self):
        # create a sample image in memory


        self.su1 = u'kanso <Diagnosis>**diabetes**</Diagnosis> utesl\xf6t eller diabetes men inte s\xe4kert. Vi siktar p\xe5 en r\xf6ntgenkontroll. kan det vara nej panik\xe5ngesten\n?'
        self.su2 =  u'IMPRESSION: 1. LIMITED STUDY DEMONSTRATING NO GROSS EVIDENCE OF SIGNIFICANT PULMONARY EMBOLISM.'
        self.su3 = u'This is a sentence that does not end with a number. But this sentence ends with 1. So this should be recognized as a third sentence.'
        self.su4 = u'This is a sentence with a numeric value equal to 1.43 and should not be split into two parts.'
        self.items = {"targets":[ CI.create_ConTextItem([u"pulmonary embolism",
                                   u"PULMONARY_EMBOLISM",
                                   r"""pulmonary\s(artery )?(embol[a-z]+)""",
                                   ""]),
                                   ],
                       "modifiers":[CI.create_ConTextItem(["no gross evidence of",
                                     "PROBABLE_NEGATED_EXISTENCE",
                                     "",
                                     "forward"])]}



        self.ci0 = self.items['targets'][0]
        self.ci1 = self.items['modifiers'][0]
        self.ti0 = TI.create_tagItem(self.ci0,(20,25),"Brian Chapman",0)
        self.ti1 = TI.create_tagItem(self.ci0,( 5,30),"Wendy Chapman",1)
        self.markup = nx.DiGraph()
        self.markup.add_nodes_from([self.ti0,self.ti1])
예제 #2
0
    def setUp(self):
        # create a sample image in memory

        self.su1 = u'kanso <Diagnosis>**diabetes**</Diagnosis> utesl\xf6t eller diabetes men inte s\xe4kert. Vi siktar p\xe5 en r\xf6ntgenkontroll. kan det vara nej panik\xe5ngesten\n?'
        self.su2 = u'IMPRESSION: 1. LIMITED STUDY DEMONSTRATING NO GROSS EVIDENCE OF SIGNIFICANT PULMONARY EMBOLISM.'
        self.su3 = u'This is a sentence that does not end with a number. But this sentence ends with 1. So this should be recognized as a third sentence.'
        self.su4 = u'This is a sentence with a numeric value equal to 1.43 and should not be split into two parts.'
        self.items = {
            "targets": [
                CI.create_ConTextItem([
                    u"pulmonary embolism", u"PULMONARY_EMBOLISM",
                    r"""pulmonary\s(artery )?(embol[a-z]+)""", ""
                ])
            ],
            "modifiers": [
                CI.create_ConTextItem([
                    "no gross evidence of", "PROBABLE_NEGATED_EXISTENCE", "",
                    "forward"
                ])
            ]
        }

        self.ci0 = self.items['targets'][0]
        self.ci1 = self.items['modifiers'][0]
        self.ti0 = TI.create_tagItem(self.ci0, (20, 25), "Brian Chapman", 0)
        self.ti1 = TI.create_tagItem(self.ci0, (5, 30), "Wendy Chapman", 1)
        self.markup = nx.DiGraph()
        self.markup.add_nodes_from([self.ti0, self.ti1])
        self.cd = CD.ConTextDocument()
예제 #3
0
    def test_o1_encompasses_o2(self):

        ti0 = TI.create_tagItem(self.ci0,(20,25),"Brian Chapman",0)
        ti1 = TI.create_tagItem(self.ci0,( 5,30),"Wendy Chapman",1)
        assert TI.o1_encompasses_o2(ti1,ti0)
        assert not TI.o1_encompasses_o2(ti0,ti1)
예제 #4
0
 def test_limitCategoryScopeBackward(self):
     ti0 = TI.create_tagItem(self.ci0,(20,30),"Brian Chapman",0)
     ti1 = TI.create_tagItem(self.ci0,( 5,15),"Wendy Chapman",1)
     assert TI.lessthan(ti1,ti0)
     assert not TI.lessthan(ti0,ti1)
예제 #5
0
 def test_create_tagItem(self):
     ti = TI.create_tagItem(self.ci0,(20,30),"Brian Chapman",0)
     assert ti.span == (20,30)
예제 #6
0
 def test_limitCategoryScopeBackward(self):
     ti0 = TI.create_tagItem(self.ci0, (20, 30), "Brian Chapman", 0)
     ti1 = TI.create_tagItem(self.ci0, (5, 15), "Wendy Chapman", 1)
     assert TI.lessthan(ti1, ti0)
     assert not TI.lessthan(ti0, ti1)
예제 #7
0
 def test_create_tagItem(self):
     ti = TI.create_tagItem(self.ci0, (20, 30), "Brian Chapman", 0)
     assert ti.span == (20, 30)
예제 #8
0
    def test_o1_encompasses_o2(self):

        ti0 = TI.create_tagItem(self.ci0, (20, 25), "Brian Chapman", 0)
        ti1 = TI.create_tagItem(self.ci0, (5, 30), "Wendy Chapman", 1)
        assert TI.o1_encompasses_o2(ti1, ti0)
        assert not TI.o1_encompasses_o2(ti0, ti1)