<p>作为我正在进行的一个更大的个人项目的一部分,我试图从各种文本源中分离出内联日期。</p>
<p>例如,我有一大串字符串(通常采用英语句子或语句的形式),它们有多种形式:</p>
<blockquote>
<p>Central design committee session Tuesday 10/22 6:30 pm</p>
<p>Th 9/19 LAB: Serial encoding (Section 2.2)</p>
<p>There will be another one on December 15th for those who are unable to make it today.</p>
<p>Workbook 3 (Minimum Wage): due Wednesday 9/18 11:59pm</p>
<p>He will be flying in Sept. 15th.</p>
</blockquote>
<p>虽然这些日期与自然文本一致,但没有一个日期本身是以特定的自然语言形式出现的(例如,没有“会议将在明天两周后举行”——这都是明确的)。</p>
<p>作为一个对这种处理没有太多经验的人,什么是最好的开始?我研究过诸如<code>dateutil.parser</code>模块和<a href="https://github.com/bear/parsedatetime">parsedatetime</a>之类的东西,但这些似乎是在您隔离了日期之后用于<em>的。</p>
<p>因此,有没有什么好的方法来提取日期和无关的文本</p>
<pre><code>input: Th 9/19 LAB: Serial encoding (Section 2.2)
output: ['Th 9/19', 'LAB: Serial encoding (Section 2.2)']
</code></pre>
<p>或者类似的?这类处理似乎是由Gmail和Apple Mail等应用程序完成的,但是否可以用Python实现呢?</p>