From 8f6a81b4db36e3c965e34e6fa5ba0396f17cc55d Mon Sep 17 00:00:00 2001 From: markdevel Date: Sat, 7 Apr 2018 12:21:38 +0900 Subject: [PATCH] fixed bpos has an invalid value if token is empty --- natto/mecab.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/natto/mecab.py b/natto/mecab.py index e9d7c90..e70b4a4 100644 --- a/natto/mecab.py +++ b/natto/mecab.py @@ -350,6 +350,8 @@ def __parse_tonodes(self, text, **kwargs): self.lattice, bpos, self.MECAB_TOKEN_BOUNDARY) for (token, match) in tokens: + if token == '': + continue bpos += 1 if match: mark = self.MECAB_INSIDE_TOKEN