日付選択のための自然言語処理

Our date picker and conversion is a powerful feature. I’d love to see us make it simpler to add a date/time to a post. A common way this is done is through natural language processing. Apps like Fantastical on iOS have used this for years for date input.

Instead of fiddling with the mouse to input a date, you could type in something like:

  • monday at 2pm which would output the date and time to your timezone
  • next friday at 10am NZST which outputs the date/time next friday in NZST
  • 11am which outputs today’s date at 11am
  • 8/9 to 8/13 which outputs a date range.

This could either replace the modal shown by clicking the calendar icon in the composer with a textbox (and an advanced button which shows the existing modal contents) or a separate modal launched by a keyboard shortcut.

「いいね!」 9

This library might help with implementation: GitHub - wanasit/chrono: A natural language date parser in Javascript

That said I suspect it would be a challenge to get robust language support for this.

The current fully supported languages are en , ja , and fr ( de and pt are partially supported). Other languages from v1 ( nl and zh ) are under development.


Also, another UX pattern to consider is automatically replacing date strings in the body of a post with Discourse date/time objects. Sort of like one-boxing but for dates. E.g. if I type “next monday at 2pm” in my post, it automatically converts that to 2021-08-17T18:00:00Z.

「いいね!」 5

I really like this idea!

「いいね!」 3

このアイデアはとても気に入りました。どのように機能するか、UIモックアップを見せていただけますか?それがここで欠けているものです。

UIすら不要になるかもしれません。投稿がベイクされたら、NLPが処理し、クライアントに戻ってシンプルなモーダルで確認できます。

1つの日付が見つかりました。動的なタイムスタンプに変換しますか?
- 火曜日午後2時 --> [discourse date]

あるいは、もっとシンプルにすることもできます。カレンダーアイコンをクリックすると、日付選択ではなく、シンプルなテキストボックスになります。

そして、招待モーダルと同様に、より詳細なオプションのために既存の日付/時刻/タイムゾーンピッカーを表示する高度なコントロール用のボタンを設けることもできます。

それを決定するのは @j.jaffeux さんだと思いますが、現在のUIに全く合っているか分かりません。また、スマートフォンで特に、クリックするよりも普通の人々がそんなに多く入力したいと思うのか疑問です。

Googleカレンダーでは、イベントの名前を入力しているときにこれができるので理にかなっています。例えば、

「配管工」

と入力する代わりに、

「配管工 午後3時~午後5時」

と入力しますが、これはキーボード付きのデバイスを使っているので簡単です。

私は、デスクトップとモバイルの両方で、私たちのモーダルは使いにくいと感じています。だからこそ、そもそもこの機能を提案したのです。スクロールホイールを使ったり、大きなモーダルをクリックしたりするよりも、モーダルに「today at 11:31am」と入力する方がはるかに高速です。多くのカレンダーがすでにこれを行っているという事実は、人々が理解するための精神的な負担を軽減します。

「いいね!」 1

デスクトップでは同意しますが、スマートフォンでは同意しません。スマートフォンのタイピングはひどいからです。これはデスクトップ限定の動作にすることも可能でしょうか?

「いいね!」 1

個人的にはそれで構いません。

これを行うためのコードはすでに多数ありますが、これは @daniel と共同で作業したものです。

基本的に 3 つの解決策があります。

  • より良いモーダル
  • 何らかの !コマンド
  • テキスト解析

テキスト解析は素晴らしいですが、すべてを解決するわけではなく、すべてのロケールで機能させる必要があります。しかし、小さなサブセットのサポートを有効にできることには同意します。ほとんどはすでにここにあり、完了/有効にするだけです。

「いいね!」 5