def test_all_attributes_in_irrelevant_markup_are_false(self): i_sentence = 'This could possibly be a sign of pneumonia in the lungs.' i_markup = fc.markup_sentence(i_sentence) i_classifier = fc.markup_conditions(markup=i_markup) attributes = list(i_classifier.__dict__.keys()) for a in attributes: if a not in ['target_values', 'modifiers']: self.assertFalse(i_classifier.__dict__[a])
def setUp(self): self.txt = 'There is fluid collection in the abdomen. There is no hematoma near the liver. Evaluate for abscess.' self.sentenceSpanPairs = helpers.my_sentence_splitter(self.txt) self.sentences = [x.text for x in self.sentenceSpanPairs] self.spans = [x.span for x in self.sentenceSpanPairs] self.modifiers = fc.modifiers self.targets = fc.targets self.markups = [fc.markup_sentence(x) for x in self.sentences] self.document = fc.create_context_doc(self.markups)
def setUp(self): self.txt = 'There is fluid collection in the abdomen. There is no hematoma near the liver. Evaluate for abscess.' self.sentenceSpanPairs = helpers.my_sentence_splitter(self.txt) self.sentences = [x.text for x in self.sentenceSpanPairs] self.spans = [x.span for x in self.sentenceSpanPairs] #self.sentences = self.sentences.remove('') self.modifiers = itemData.instantiateFromCSVtoitemData( "/Users/alec/Box Sync/Bucher_Surgical_MIMICIII/pyConText_implement/fcFinder/modifiers.tsv" ) self.targets = itemData.instantiateFromCSVtoitemData( "file:///Users/alec/Box Sync/Bucher_Surgical_MIMICIII/pyConText_implement/fcFinder/targets.tsv" ) self.markups = [fc.markup_sentence(x) for x in self.sentences] self.first_markup = self.markups[0] self.document = fc.create_context_doc(self.markups)
def setUp(self): self.txt = 'There is fluid collection in the abdomen. There is no hematoma near the liver. Evaluate for abscess.' self.sentenceSpanPairs = helpers.my_sentence_splitter(self.txt) self.sentences = [x.text for x in self.sentenceSpanPairs] self.spans = [x.span for x in self.sentenceSpanPairs] self.modifiers = fc.modifiers self.targets = fc.targets self.markups = [fc.markup_sentence(x) for x in self.sentences] self.document = fc.create_context_doc(self.markups) self.empty_markup = pyConText.ConTextMarkup() self.first_markup = self.markups[0] self.second_markup = self.markups[1] self.third_markup = self.markups[2] self.first_classifier = fc.markup_conditions(markup=self.first_markup) self.second_classifier = fc.markup_conditions( markup=self.second_markup) self.third_classifier = fc.markup_conditions(markup=self.third_markup) self.classifier = fc.markup_conditions(markup=self.empty_markup)
def test_indication_with_pseudo_anatomy_is_none(self): pseudo_sentence = "Evaluate for sternal fluid collection." pseudo_markup = fc.markup_sentence(pseudo_sentence) self.assertIsNone(pseudo_markup.markupClass)
def test_indication_with_pseudoanatomy_has_pseudoanatomy(self): pseudo_sentence = "Evaluate for sternal fluid collection." pseudo_markup = fc.markup_sentence(pseudo_sentence) pseudo_conditions = fc.markup_conditions(markup=pseudo_markup) self.assertTrue(pseudo_conditions.pseudoanatomy)
def test_default_markup_sentence_span_starts_with_zero(self): self.assertEqual( fc.markup_sentence(self.sentences[0]).docSpan, self.spans[0])