From f89830146af0a1ffe1869f3f96c0c2b6443d7a09 Mon Sep 17 00:00:00 2001 From: jzonthemtn Date: Mon, 16 Dec 2024 10:17:41 -0500 Subject: [PATCH] #176 Updating tests from replacing lucene filter. --- .../filters/HospitalAbbreviationFilterTest.java | 2 +- .../rules/dictionary/FuzzyDictionaryFilter.java | 10 +++++++++- ...tals-abbreviations => hospital-abbreviations} | 16 ++++++++-------- 3 files changed, 18 insertions(+), 10 deletions(-) rename phileas-model/src/main/resources/{hospitals-abbreviations => hospital-abbreviations} (99%) diff --git a/phileas-core/src/test/java/ai/philterd/test/phileas/services/filters/HospitalAbbreviationFilterTest.java b/phileas-core/src/test/java/ai/philterd/test/phileas/services/filters/HospitalAbbreviationFilterTest.java index 2cc09ac4b..55646287d 100644 --- a/phileas-core/src/test/java/ai/philterd/test/phileas/services/filters/HospitalAbbreviationFilterTest.java +++ b/phileas-core/src/test/java/ai/philterd/test/phileas/services/filters/HospitalAbbreviationFilterTest.java @@ -52,7 +52,7 @@ public void filter1() throws Exception { final FilterResult filterResult = filter.filter(getPolicy(), "context", "documentid", PIECE, "Went to WMC", attributes); showSpans(filterResult.getSpans()); - Assertions.assertEquals(4, filterResult.getSpans().size()); + Assertions.assertEquals(1, filterResult.getSpans().size()); } diff --git a/phileas-model/src/main/java/ai/philterd/phileas/model/filter/rules/dictionary/FuzzyDictionaryFilter.java b/phileas-model/src/main/java/ai/philterd/phileas/model/filter/rules/dictionary/FuzzyDictionaryFilter.java index 402236699..745290dd0 100644 --- a/phileas-model/src/main/java/ai/philterd/phileas/model/filter/rules/dictionary/FuzzyDictionaryFilter.java +++ b/phileas-model/src/main/java/ai/philterd/phileas/model/filter/rules/dictionary/FuzzyDictionaryFilter.java @@ -49,7 +49,15 @@ public FilterResult filter(Policy policy, String context, String documentId, int final Map> ngrams = new HashMap<>(); ngrams.put(0, splitWithIndexes(input, " ")); - for(int x = 1; x < 10; x++) { + final int maxNgrams; + + if(filterType == FilterType.HOSPITAL) { + maxNgrams = 20; + } else { + maxNgrams = 5; + } + + for(int x = 1; x < maxNgrams; x++) { ngrams.put(x, getNgrams(input, x)); } diff --git a/phileas-model/src/main/resources/hospitals-abbreviations b/phileas-model/src/main/resources/hospital-abbreviations similarity index 99% rename from phileas-model/src/main/resources/hospitals-abbreviations rename to phileas-model/src/main/resources/hospital-abbreviations index 6b162e539..015755380 100644 --- a/phileas-model/src/main/resources/hospitals-abbreviations +++ b/phileas-model/src/main/resources/hospital-abbreviations @@ -1082,7 +1082,7 @@ KHOU RRMC BMCSC NFRMC -MCNH( +MCNH TCH KMH OVH @@ -2392,7 +2392,7 @@ BHCMH FHS-FW NSH AOMC -SMH(T) +SMH CVPHMC PBH WMHI @@ -2647,7 +2647,7 @@ JSH RUH HSJH MCHR -UHOB(D) +UHOB CSHAC MHL NOCHS @@ -2660,7 +2660,7 @@ VWJHV HCH WMC&S HCHAC -SHFC( +SHFC RJAPR BMH RSMC @@ -3484,7 +3484,7 @@ MRH GAMC LMHS SCH -UOTMC( +UOTMC NCH GPMH HMC @@ -3842,7 +3842,7 @@ BMHUC SVH SMC BH -M(NMC +MNMC CMH IGH PHC @@ -4796,7 +4796,7 @@ AAC AC ASC AWC -AGH(LH +AGHLH AMC AGH ARMC @@ -6946,7 +6946,7 @@ SMRMC SMRMC SMRMCoR SMSHH -SPH(N +SPHN SPGH SRMC SRDH-RDLC