I have the below sentences. I need to split the sentences into multiple sentences if the sentence has dot or a matched word.
Sentence 1: There was an error while trying to serialize parameter http://uri.org/:Message. The InnerException message with data contract name 'enumStatus:' is not expected.
Expected result:
senetences = 1. There was an error while trying to serialize parameter http://uri.org/:vMessage.
2. The InnerException message with data contract name 'enumStatus:' is not expected.
Sentence 2: ORA-01756: quoted string not properly terminated ORA-06512: at module1, line 48 ORA-06512: at line 1
Expected result:
senetences = 1. ORA-01756: quoted string not properly terminated
2. ORA-06512: at module1, line 48
3. ORA-06512: at line 1
I am using below regex to split the sentences.
sentences = re.split(r'(?<=\w\.)\s|ORA-[0-9]{1,8}', input)
Issue here is, for the first case, if any word followed by dot is working fine. For the second case, I am able to split the sentence. I have 2 issues.
- It is removing the entire match word 'ORA-'. But I need the entire word.
- I am getting 4 sentences instead of 3 sentences.
- (first is empty since it has starting word ORA-)
- quoted string not properly terminated
- at module1, line 48
- at line 1
I need 3 sentences in this case.
Any help would be really appreciated.