Skip to main content

Analyze and parse natural language temporal expression from Japanese sentences

Project description

ja-timex

自然言語で書かれた時間情報表現を抽出/規格化するルールベースの解析器

概要

ja-timex は、現代日本語で書かれた自然文に含まれる時間情報表現を抽出しTIMEX3と呼ばれるアノテーション仕様に変換することで、プログラムが利用できるような形に規格化するルールベースの解析器です。

以下の機能を持っています。

  • ルールベースによる日本語テキストからの日付や時刻、期間や頻度といった時間情報表現を抽出
  • アラビア数字/漢数字、西暦/和暦などの多彩なフォーマットに対応
  • 時間表現のdatetime/timedelta形式への変換サポート

入力

from ja_timex import TimexParser

timexes = TimexParser().parse("彼は2008年4月から週に3回ジョギングを1時間行ってきた")

出力

[<TIMEX3 tid="t0" type="DATE" value="2008-04-XX" text="2008年4月">,
 <TIMEX3 tid="t1" type="SET" value="P1W" freq="3X" text="週に3回">,
 <TIMEX3 tid="t2" type="DURATION" value="PT1H" text="1時間">]

datetime/timedeltaへの変換

# <TIMEX3 tid="t0" type="DATE" value="2008-04-XX" text="2008年4月">
In []: timexes[0].to_datetime()
Out[]: DateTime(2008, 4, 1, 0, 0, 0, tzinfo=Timezone('Asia/Tokyo'))
# <TIMEX3 tid="t2" type="DURATION" value="PT1H" text="1時間">
In []: timexes[2].to_duration()
Out[]: Duration(hours=1)

インストール

pip install ja-timex

ドキュメント

ja-timex documentation

参考仕様

本パッケージは、以下の論文で提案されている時間情報アノテーションの枠組みを元に作成しています。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ja-timex-0.1.5.tar.gz (34.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ja_timex-0.1.5-py3-none-any.whl (21.9 kB view details)

Uploaded Python 3

File details

Details for the file ja-timex-0.1.5.tar.gz.

File metadata

  • Download URL: ja-timex-0.1.5.tar.gz
  • Upload date:
  • Size: 34.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.7 CPython/3.8.3 Darwin/20.4.0

File hashes

Hashes for ja-timex-0.1.5.tar.gz
Algorithm Hash digest
SHA256 b3690c7e81f8e198980209a4ede5605a59586258f0a9d4545b903fd36d4fdd02
MD5 f5eb8c00ce14dba4c23515a643ea9d94
BLAKE2b-256 a1394d0380ac59b25a96710369ddde2157ae02ca973478d982d60a6d96b4718b

See more details on using hashes here.

File details

Details for the file ja_timex-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: ja_timex-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 21.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.7 CPython/3.8.3 Darwin/20.4.0

File hashes

Hashes for ja_timex-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 7dcd2c1714069adba8ed86c01f5928b8a391f443cd4b7a703df14516c5f2686e
MD5 f52a713f6dd5fc3b6fbb1ba1f97ef332
BLAKE2b-256 1b8dbf8e23ec10718b3494c8910521fd7259fad781a540f3581cd40ba41b1333

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page