diff --git a/torch_geometric/nn/nlp/txt2kg.py b/torch_geometric/nn/nlp/txt2kg.py index 1042b452c499..01085e8202c6 100644 --- a/torch_geometric/nn/nlp/txt2kg.py +++ b/torch_geometric/nn/nlp/txt2kg.py @@ -140,8 +140,8 @@ def add_doc_2_KG( def get_chunks(s, maxlength): start = 0 end = 0 - while start + maxlength < len(s) and end != -1: + while start + maxlength < len(s) and end != -1: end = s.rfind(" ", start, start + maxlength + 1) yield s[start:end] - start = end +1 + start = end + 1 yield s[start:]