作为我正在开展的一个更大的个人项目的一部分,我试图将内联日期与各种文本源分开.
例如,我有一大串字符串(通常采取英文句子或语句的形式),采用各种形式:
Central design committee session Tuesday 10/22 6:30 pm
Th 9/19 LAB: Serial encoding (Section 2.2)
There will be another one on December 15th for those who are unable to make it today.
Workbook 3 (Minimum Wage): due Wednesday 9/18 11:59pm
He will be flying in Sept. 15th.
虽然这些日期与自然文本是一致的,但他们自己也不是特别自然的语言形式(例如,没有“会议将从明天起两个星期” – 这一切都是明确的).
作为一个没有太多这种处理经验的人,最好的开始是什么?我已经研究了如dateutil.parser模块和parsedatetime的东西,但是那些似乎是在你隔离了日期之后.
因此,有没有什么好的方法来提取日期和无关的文本
input: Th 9/19 LAB: Serial encoding (Section 2.2)
output: ['Th 9/19', 'LAB: Serial encoding (Section 2.2)']
还是类似的东西?似乎这样的处理是由Gmail和Apple Mail等应用程序完成的,但是可以在Python中实现吗?