拆分文本在C#中的句子 [英] Split text into sentences in C#

查看:645
本文介绍了拆分文本在C#中的句子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要划分一个文本句子。一个句子用(点)或结束?要么 ! 。后面跟着一个或多个空格字符,随后和下一个句子以大写字母开头

I want to divide a text into sentences. A sentence ends with (dot) or ? or ! followed by one or more whitespace characters followed and the next sentence starts with an uppercase letter.

例如:

第一句话。第二句!

我怎么能这样做?

推荐答案

什么语言你要支持?例如,在泰国有单词和句子之间没有空格,空间是分开的。因此,在一般情况下,这个任务是非常复杂的。也可以考虑由Fredrik MORK有用的评论。

What languages do you want to support? For example, in Thai there are no spaces between words and sentences are separated with space. So, in general, this task is very complex. Also consider the useful comment by Fredrik Mörk.

所以,首先需要定义一套关于什么是一句话就是规则。然后,欢迎您使用建议的解决方案之一。

So, at first you need to define set of rules on what "sentence" is. Then you are welcome to use one of the suggested solutions.

这篇关于拆分文本在C#中的句子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆