-
-
Save BasementCat/4515964 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
with open("infile.txt", "r") as fp: | |
queue="" | |
match=r"[?!.]+\s+" | |
for rawLine in fp: | |
rawLine=" ".join((queue, rawLine)) | |
queue="" | |
lines=rawLine.split(match) | |
if re.search(match+"$", rawLine): | |
queue=lines.pop() | |
for realLine in lines: | |
#feed line to bot here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment