Regex in python to split sentences by fullstop but ignore abbreviations and dates which contain fullstop?

  Kiến thức lập trình

I want to search for a keyword in the text and to extract this sentence which contains the keyword. When extracting the sentence, I want to ignore fullstops in dates and fullstops in some shortenings (‘st’ and ‘numb’)

Example:
keyword = grand
text:

. The boy will visit his grandmother tomorrow on 01.02.2024 who lives on Downing st. 10. The following day he will go to school. The day after on 03.02.2014 he will visit his grandfather

I expect the two sentences which contain the keyword ‘grand’, where the fullstops in dates and the shortening ‘st’ are ignored:

[“The boy will visit his grandmother tomorrow on 01.02.2024 who lives on Downing st. 10.”,
“The day after on 03.02.2014 he will visit hist grandfather

“]

New contributor

Martina Nacheva is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT