It can get annoying to wait till the text is done generating to start the speech. It's better to one sentence at the time.
Since it's practically impossible to do good sentence detection programmatically using regex or similar techniques, the best solution is to have ChatGPT itself tell us where a sentence starts and ends.
Options:
- The easiest approach is to ask it to start each sentence on a new line.
- A more elegant solution is to ask it to introduce characters that are invisible to the user, but are detectable programmatically, such as 3 consecutive spaces. Since we're only dealing with text generated one entity, we don't need to worry too much about edge cases.