Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
Making it possible to determine the split location in long messages (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
JackUrb authored Jun 14, 2018
1 parent 1f9a0ff commit be7f6e3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions parlai/messenger/core/message_sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ def _message(text_content, replies):
)
)
for i in range(len(tokens)):
if tokens[i] == '[*SPLIT*]':
if ' '.join(tokens[cutoff:i-1]).strip() != '':
splits.append(_message(' '.join(tokens[cutoff:i-1]), None))
cutoff = i + 1
curr_length = 0
if (curr_length + len(tokens[i]) > MAX_TEXT_CHARS):
splits.append(_message(' '.join(tokens[cutoff:i]), None))
cutoff = i + 1
Expand Down

0 comments on commit be7f6e3

Please sign in to comment.