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
ドキュメント
参考仕様
本パッケージは、以下の論文で提案されている時間情報アノテーションの枠組みを元に作成しています。
Metadata
Release files for ja-timex 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ja-timex-0.2.0.tar.gz | 22.3 kB | Without provenance | Details for ja-timex-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ja_timex-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for ja_timex-0.2.0-py3-none-any.whl |
Total release size: 47.8 kB
Release files / ja-timex-0.2.0.tar.gz
| Download URL | ja-timex-0.2.0.tar.gz |
|---|---|
| Size | 22.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e0d9b834db9eb993acb283e36f7ed4c3d020f1b501363e3ac856f2653f362cf4
|
|
BLAKE2b-256 checksum How to use checksums |
a206b9a131d93c9a751760c5d3ee69477f6ac8be3fe55c3dbc675fb8ad911699
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.8 CPython/3.8.11 Linux/5.8.0-1040-azure
|
Release files / ja_timex-0.2.0-py3-none-any.whl
| Download URL | ja_timex-0.2.0-py3-none-any.whl |
|---|---|
| Size | 25.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
91ab4db99f6a1ce0128aaba8d73b5ee0e1aa180395429395b74f15367a6bd311
|
|
BLAKE2b-256 checksum How to use checksums |
85caa36a948d5e45e22a4472eb3e5f9199335d76dafb72833c0bad47d783366d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.8 CPython/3.8.11 Linux/5.8.0-1040-azure
|
Security for ja-timex 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.