diff --git a/torch_geometric/nn/nlp/txt2kg.py b/torch_geometric/nn/nlp/txt2kg.py index cbd4b6858332..c356e61a6965 100644 --- a/torch_geometric/nn/nlp/txt2kg.py +++ b/torch_geometric/nn/nlp/txt2kg.py @@ -139,8 +139,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:]