Any idea how to read a text file one sentence at a time instead of one line at a time.
The general idea would be to may be read-ahead and when the end-of-sentence is detected return the sentence.
Now here comes the tricky part EOS is normally a "dot", but not always.
Tools like spacy can detect EOL, but expect the whole document to be available.
If the logic is to be hidden as generator/iterator the code would look like ...
with SentenceFile.open(....) as sf :
for sent in sf.next_stentence() :
.....