I am using the following code to chunk a text with conjunction words. However I wish to add "," comma character as well. So whenever a text faces with one of conjunction words or comma it splits the text. How can I do that?
import re
sent = 'food good and service bad'
result = re.split(r"\s+(?:but|and|because|,)\s+", sent)
Maybe this is what are you looking for?
Prints: