如何从以下段落中获得第一句话?

sam*_*kgp 4 python nlp text-segmentation

我知道这听起来很容易.我想过使用第一个点(.)作为基准,但是当缩写和简短形式出现时,我变得无助.

例如 -

Sir Winston Leonard Spencer-Churchill,KG,OM,CH,TD,PC,DL,FRS,Hon.RA(1874年11月30日 - 1965年1月24日)是一位英国政治家和政治家,因其在第二次世界大战期间领导英国而闻名.他被广泛认为是战时最伟大的领导人之一,曾两次担任总理.丘吉尔是一位着名的政治家和演说家,也是英国军队的一名军官,历史学家,作家和艺术家.

在这里,第一个点是Hon.,但我希望完整的第一行在第二次世界大战结束.

有可能是人???

fra*_*xel 8

如果使用nltk,可以添加缩写,如下所示:

>>> import nltk
>>> sent_detector = nltk.data.load('tokenizers/punkt/english.pickle')
>>> sent_detector._params.abbrev_types.add('hon')
>>> sent_detector.tokenize(your_text)
['Sir Winston Leonard Spencer-Churchill, KG, OM, CH, TD, PC, DL, FRS, Hon. RA 
(30 November 1874 \xe2\x80\x93 24 January 1965) was a British politician and 
statesman known for his leadership of the United Kingdom during the Second 
World War.', 
'He is widely regarded as one of the great wartime leaders and served as Prime 
Minister twice.', 
'A noted statesman and orator, Churchill was also an officer in the British Army,
a historian, a writer, and an artist.']
Run Code Online (Sandbox Code Playgroud)

这种方法基于Kiss&Strunk 2006,它报告了Punkt的F分数(精度和召回的调和平均值)在91%到99%之间,具体取决于测试语料库.

Kiss,Tibor和Jan Strunk."无监督多语种句边界检测". 计算语言学,(32)485-525.