Python extract sentence after a keyword is found

I have a string based on some text I have extracted and a list of keywords. I woud like to run through the string and extract only the sentence after the sentence where the keyword is found and remove the full stop too.

String

'Test string. removing data. keyword extraction. data number. 11123. final answer.'

Here is my list of key phrases:

lst= ['Test string', 'data number']

Desired output:

['removing data', '11123']

Please could someone help me out/ point in the right direction? Thanks



Read more here: https://stackoverflow.com/questions/65706082/python-extract-sentence-after-a-keyword-is-found

Content Attribution

This content was originally published by qwerty12 at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: