段落を文に分割する正規表現があります。
var sentences = /[^\.!\?]+[\.!\?]+/g;
[\.!\?]+
句読点 ( ) の後に空白がある場合にのみ一致させたいと思い\s
ます。試してみ/[^\.!\?]+[\.!\?]+\s/g
ましたが、うまくいきませんでした。
これが必要な理由は、現在、途中に句読点のある単語がある場合 ( のように) 、そうでない場合に文の終わりを表すabout.me
ように分割されているためです。.
何か案は?
例えば:
この段落がある場合:
If the problem being solved isn't as apparent or immediately useful as traffic about.me and navigation data: weather. A few apps are trying to harness the crowd to provide accurate?
にのみ分割したい
['If the problem being solved isn't as apparent or immediately useful as traffic about.me and navigation data: weather.', 'A few apps are trying to harness the crowd to provide accurate?']
一方、現在はに分割されています
['If the problem being solved isn't as apparent or immediately useful as traffic about.', 'me and navigation data: weather.', 'A few apps are trying to harness the crowd to provide accurate?']
.