I'm trying to segment a paragraph to sentences. I selected '.', '?' and '!' as the segmentation symbols. I tried:
format = r'((! )|(. )|(? ))'
delimiter = re.compile(format)
s = delimiter.split(line)
but it gives me sre_constants.error: unexpected end of pattern
I also tried
format = [r'(! )',r'(? )',r'(. )']
delimiter = re.compile(r'|'.join(format))
it also causes error.
What's wrong with my method?