【发布时间】:2014-08-07 12:43:58
【问题描述】:
我需要将以下段落拆分为句子,但忽略在使用诸如 Mr. Mrs. Ms. 等前缀标题的点处拆分。
string text = "Joffrey died on March 25, 1988 of AIDS at the age of 57 in New York City, New York. He is buried at Cathedral of Saint John the Divine. Mr.Joffrey was inducted into the National Museum of Dance's Mr. & Mrs. Cornelius Vanderbilt Whitney Hall of Fame in 2000."
一个普通的正则表达式语句,例如:@"(?<=[\.!\?])\s+" 会成功拆分句子,但也会拆分诸如 Mr.Joffrey 之类的单词,这是我想要避免的。
澄清这个问题的正则表达式将非常有帮助:)
【问题讨论】:
-
首字母缩写的文本怎么样,例如“著名漫画的作者 Gary M. Larson 是 S.O.L.,昨天一头牛决定撞上他的车”。
-
@LasseV.Karlsen Lucas Trzesniewski 的回答也解决了这个问题:)