From 5431742783b31ffc2b48f31fbffdbb2c5b7b3266 Mon Sep 17 00:00:00 2001 From: Andrew Wen Date: Sat, 9 Sep 2023 17:32:04 -0500 Subject: [PATCH] Don't assume split will always return size 1 --- pom.xml | 2 +- .../backbone/SectionResolutionTransform.java | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 7a0c45e..c783bac 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.ohnlp.medtagger medtagger - 1.0.70 + 1.0.71 The MedTagger biomedical information extraction pipeline diff --git a/src/main/java/org/ohnlp/medtagger/backbone/SectionResolutionTransform.java b/src/main/java/org/ohnlp/medtagger/backbone/SectionResolutionTransform.java index 539f03d..b29dafc 100644 --- a/src/main/java/org/ohnlp/medtagger/backbone/SectionResolutionTransform.java +++ b/src/main/java/org/ohnlp/medtagger/backbone/SectionResolutionTransform.java @@ -65,10 +65,13 @@ public void process(ProcessContext pc) { if (s.trim().length() == 0) { return; } - String cand = s.split(":")[0].trim(); - if (cand.length() > 0) { - // And output - pc.output(KV.of(cand, 1)); + String[] parsed = s.split(":"); + if (parsed.length > 0) { + String cand = parsed[0].trim(); + if (cand.length() > 0) { + // And output + pc.output(KV.of(cand, 1)); + } } });