diff --git a/src/main/java/com/hankcs/hanlp/seg/common/wrapper/SegmentWrapper.java b/src/main/java/com/hankcs/hanlp/seg/common/wrapper/SegmentWrapper.java index 75a3872dc..dfc82f76d 100644 --- a/src/main/java/com/hankcs/hanlp/seg/common/wrapper/SegmentWrapper.java +++ b/src/main/java/com/hankcs/hanlp/seg/common/wrapper/SegmentWrapper.java @@ -13,6 +13,7 @@ import com.hankcs.hanlp.seg.Segment; import com.hankcs.hanlp.seg.common.Term; +import com.hankcs.hanlp.utility.TextUtility; import java.io.BufferedReader; import java.io.IOException; @@ -58,7 +59,12 @@ public Term next() throws IOException { if (termArray != null && index < termArray.length) return termArray[index++]; String line = br.readLine(); - if (line == null) return null; + while (TextUtility.isBlank(line)) + { + if (line == null) return null; + line = br.readLine(); + } + List termList = segment.seg(line); if (termList.size() == 0) return null; termArray = termList.toArray(new Term[0]);