Exemplo n.º 1
0
 def test_prune_false(self):
     matcher = MedspacyMatcher(nlp, prune=False)
     matcher.add(
         [BaseRule("history of", "HISTORICAL"), BaseRule("no history of", "NEGATED_EXISTENCE"),]
     )
     doc = nlp("no history of pneumonia")
     matches = matcher(doc)
     assert len(matches) == 2
Exemplo n.º 2
0
 def test_prune_overlapping_matching(self):
     matcher = MedspacyMatcher(nlp, prune=True)
     matcher.add(
         [BaseRule("history of", "HISTORICAL"), BaseRule("no history of", "NEGATED_EXISTENCE"),]
     )
     doc = nlp("no history of pneumonia")
     matches = matcher(doc)
     assert len(matches) == 1
     _, start, end = matches[0]
     assert doc[start:end].text == "no history of"
Exemplo n.º 3
0
 def test_add(self):
     matcher = MedspacyMatcher(nlp)
     matcher.add([BaseRule("pneumonia", "CONDITION")])
     assert matcher._rules
Exemplo n.º 4
0
 def test_initiate(self):
     assert MedspacyMatcher(nlp)