Exemple #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])
Exemple #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()
Exemple #3
0
    def setUp(self):
        # create a sample image in memory

        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,HEDGE_TERM","","forward"])]}
        self.ci0 = self.items['targets'][0]
        self.ci1 = self.items['modifiers'][0]
Exemple #4
0
    def setUp(self):
        # create a sample image in memory

        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,HEDGE_TERM", "", "forward"
                ])
            ]
        }
        self.ci0 = self.items['targets'][0]
        self.ci1 = self.items['modifiers'][0]
Exemple #5
0
 def test_read_ConTextItem1(self):
     items, headers = CI.readConTextItems(self.files['lexical_kb'][1])
     assert items
Exemple #6
0
 def test_test_rule(self):
     ci = CI.create_ConTextItem(self.items["modifiers"][0])
     assert CI.test_rule(ci,"Forward") == True
     assert CI.test_rule(ci,"forward") == True
     assert CI.test_rule(ci,"bidirection") == False
Exemple #7
0
 def test_isA(self):
     ci = CI.create_ConTextItem(self.items["modifiers"][0])
     assert CI.isA(ci,"HEART_DISEASE") == False
     assert CI.isA(ci,"HEDGE_TERM") == True
Exemple #8
0
 def test_create_ConTextItem2(self):
     ci = CI.create_ConTextItem(self.items['modifiers'][0])
     assert ci.re == self.items['modifiers'][0][0].lower().strip()
     assert len(ci.category) == 2
Exemple #9
0
 def test_create_ConTextItem(self):
     ci = CI.create_ConTextItem(self.items['targets'][0])
     assert ci.re == self.items['targets'][0][2]
     assert ci.category == (self.items['targets'][0][1].lower().strip(),)
Exemple #10
0
 def test_read_ConTextItem1(self):
     items, headers = CI.readConTextItems(self.files['lexical_kb'][1])
     assert items
Exemple #11
0
 def test_test_rule(self):
     ci = CI.create_ConTextItem(self.items["modifiers"][0])
     assert CI.test_rule(ci, "Forward") == True
     assert CI.test_rule(ci, "forward") == True
     assert CI.test_rule(ci, "bidirection") == False
Exemple #12
0
 def test_isA(self):
     ci = CI.create_ConTextItem(self.items["modifiers"][0])
     assert CI.isA(ci, "HEART_DISEASE") == False
     assert CI.isA(ci, "HEDGE_TERM") == True
Exemple #13
0
 def test_create_ConTextItem2(self):
     ci = CI.create_ConTextItem(self.items['modifiers'][0])
     assert ci.re == self.items['modifiers'][0][0].lower().strip()
     assert len(ci.category) == 2
Exemple #14
0
 def test_create_ConTextItem(self):
     ci = CI.create_ConTextItem(self.items['targets'][0])
     assert ci.re == self.items['targets'][0][2]
     assert ci.category == (self.items['targets'][0][1].lower().strip(), )