フリーフォームのテキストが解析され、特定の日付/時刻に変換される Google カレンダー (または一部の Gmail メッセージ) に沿ったものを考え出そうとしています。
いくつかの例 (簡単にするために、現在は 2013 年 1 月 1 日午前 1 時であると仮定します):
"I should call Mom tomorrow to wish her a happy birthday" -> "tomorrow" = "2013-01-02"
"The super bowl is on Feb 3rd at 6:30pm" -> "Feb 3rd at 6:30" => "2013-02-03T06:30:00Z"
"Remind me to take out the trash on Friday" => "Friday" => "2013-01-04"
まず第一に、これ (またはこれの一部) に関する既存のオープン ソース ライブラリはありますか? そうでない場合、どのようなアプローチを取るべきだと思いますか?
私はいくつかの異なる可能性を考えています:
- さまざまなユースケースごとに思いつく限りの多くの正規表現
- n-gram を見て、それらを「相対日付」、「相対曜日」、「特定の日付」、「日時」などのさまざまなシナリオに分類し、ルール エンジン (多分もっと正規表現) 実際の日付を把握します。
- Google 検索に送信し、検索結果から意味のある情報を抽出しようとします (これはおそらく現実的ではありません)。