v0.3.2: add Ph.D./M.D./M.B.A. abbreviation tests
Browse files- tests/test_evidence_spans.py +20 -0
tests/test_evidence_spans.py
CHANGED
|
@@ -106,3 +106,23 @@ class TestAbbreviationHandling:
|
|
| 106 |
spans = split_evidence(text)
|
| 107 |
assert len(spans) == 2
|
| 108 |
assert "Dr. Elena Vasquez" in spans[0].text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
spans = split_evidence(text)
|
| 107 |
assert len(spans) == 2
|
| 108 |
assert "Dr. Elena Vasquez" in spans[0].text
|
| 109 |
+
|
| 110 |
+
def test_phd_abbreviation(self):
|
| 111 |
+
text = "Dr. Sarah Chen, Ph.D., reported the findings. The patient recovered."
|
| 112 |
+
spans = split_evidence(text)
|
| 113 |
+
assert len(spans) == 2
|
| 114 |
+
assert "Ph.D." in spans[0].text
|
| 115 |
+
|
| 116 |
+
def test_md_abbreviation(self):
|
| 117 |
+
text = "Jane Smith, M.D., performed surgery. She was assisted by a nurse."
|
| 118 |
+
spans = split_evidence(text)
|
| 119 |
+
assert len(spans) == 2
|
| 120 |
+
assert "M.D." in spans[0].text
|
| 121 |
+
|
| 122 |
+
def test_mba_and_bs_abbreviations(self):
|
| 123 |
+
text = "John holds an M.B.A. and a B.S. He is now a VP. They work at a firm."
|
| 124 |
+
spans = split_evidence(text)
|
| 125 |
+
# VP. is NOT an abbreviation, so it splits. M.B.A. and B.S. are protected.
|
| 126 |
+
assert len(spans) >= 2
|
| 127 |
+
assert "M.B.A." in spans[0].text
|
| 128 |
+
assert "B.S." in spans[0].text
|