c# - Split text into sentence even Mr. Mrs. exists in a text -


I have a problem, I want to divide the text into a sentence using a whole (.)

Mr. Bean is a 14-half-hour episode of British comedy television series in which Rowan Atkinson has been starring as the title character Atkinson , Various episodes were written by Robin Drissol, Richard Curtis, and one by El Elton.

If I separate the above text, then I get 3 sentences,

1 Mr.

2. Various episodes were written by Atkinson, Robin Drissol, Richard Curtis, and one by El Elton, a British comedy television series of 14 half-hour episodes starring Rowan Atkinson as the character of Bean's title.

3. Atkinson, Robin Driscoll, Richard Curtis and an Elton


I want to include Mr. in the second sentence because the text should be divided into three sentences in three sentences.

1. Mr. Bean is a 14-half-hour episode of British comedy television series in which Rowan Atkinson is portrayed as the title character. Various episodes were written by Atkinson, Robin Drissol, Richard Curtis, and one by El Elton.

2. Atkinson, Robin Driscoll, Richard Curtis and an Elton

Please help me I appreciate the immediate response from the community.

Thank you.

If you have a short name (such as am ) Finding a way to avoid it is a difficult natural language problem.

If you want to split sentences without having to worry about Mr or about it, Mrs (and a character that might not be visible in the text, like * ), here There is a simple way:

  1. replace all the examples of the code> Mr. and Mrs. with Mr. * and Mrs. *
  2. Split Text on
  3. In the resulting array, replace all the examples of Mr. * and Mrs. * with Mr. . And Mrs. There is a version here that uses NUL as a sensitive character, because it is far more impossible to appear in this text unknowingly: Stable IEnumerable & lt; String & gt; Splitter (string sentence) {char sentinel = '\ 0'; ("Mister", "mister" + watchdog). ("Mrs.", "Mrs." + Sentinel). Change (New [] {"."}, String Split Option No.). = & Gt; S.Replace ("Mr" + Sentinel, "Mr."). Change ("Mrs." + Sentinel, "Mrs.")); }

    If you are a madman who thinks that someone is liable to show a particular character in your text, feel free to use a guid for the watchdog.

Comments