Чтобы найти все предложения в тексте с помощью регулярных выражений Python, вы можете использовать следующие методы:
Метод 1: использование функции re.split()
import re
text = "This is a sample sentence. Another sentence follows. And here is a third sentence."
sentences = re.split(r'(?<=[.!?])\s+', text)
print(sentences)
Метод 2: использование функции re.findall()
import re
text = "This is a sample sentence. Another sentence follows. And here is a third sentence."
sentences = re.findall(r'([^.!?]+[.!?])', text)
print(sentences)
Метод 3. Использование библиотеки nltk (набор инструментов для естественного языка)
import nltk
text = "This is a sample sentence. Another sentence follows. And here is a third sentence."
sentences = nltk.sent_tokenize(text)
print(sentences)