Untitled

Run Settings
LanguagePython
Language Version
Run Command
import re s = """My program needs to split my natural language text into sentences. I made a mock sentence splitter using re.split in Python 3+. It looks like this: re.split('\D[.!?]\s[A-Z]|$|\d[!?]\s|\d[.]\s[A-Z]', content) I need to split the sentence at the whitespace when the pattern occurs. But the code, as it should, will split the text at the point the pattern occurs and not at the whitespace. It will not save the last character of the sentence including the sentence terminator.""" print(s) print("------------------------------------------------") sentences = re.split('(?<=[.?!])\s', s) for idx, sentence in enumerate(sentences): print(str(idx) + ": " + sentence)
Editor Settings
Theme
Key bindings
Full width
Lines