Skip to main content

Time expression analyzer for Japanese.

Project description

Jatime: Time Expression Analyzer for Japanese

PyPI Version Python Versions License Code style: black Imports: isort Test Status

Jatime is a Python library to extract Japanese time expressions from a given text and turning them into objects. Try Jatime now from your browser!

Installing jatime

Install with pip or your favorite PyPI package manager.

$ pip install jatime

Using jatime

Here's how to analyze Japanese text using jatime. Note that "dow" means the day of the week.

From within Python

from jatime.analyzer import analyze


result = analyze("それは令和2年十月十七日の出来事でした。")
print(result)
['それは', {'string': '令和2年十月十七日', 'year': 2020, 'month': 10, 'day': 17, 'dow': 5, 'hour': None, 'minute': None}, 'の出来事でした。']

From the command line

$ jatime analyze --format-json それは令和2年十月十七日の出来事でした。
[
  "それは",
  {
    "string": "令和2年十月十七日",
    "year": 2020,
    "month": 10,
    "day": 17,
    "dow": 5,
    "hour": null,
    "minute": null
  },
  "の出来事でした。"
]

Over HTTP communication

$ jatime serve
$ curl --get "http://localhost:1729/analysis" --data-urlencode "string=それは令和2年十月十七日の出来事でした。"
["それは",{"day":17,"dow":5,"hour":null,"minute":null,"month":10,"string":"令和2年十月十七日","year":2020},"の出来事でした。"]

Features

  • Jatime does not change the given string at all. It just objectifies the extracted time expressions.
  • Jatime supports a variety of time expressions. 22:30, 午後十時半 and P.M.10:30 are all interpreted as the same time as we want.
  • Jatime tries to make up for the missing time information whenever possible. That is, jatime calculates the year given the month, day and day of the week.
  • Jatime will tell us why the time information is inconsistent if it is inconsistent.

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

jatime-0.1.0.tar.gz (15.0 kB view hashes)

Uploaded Source

Built Distribution

jatime-0.1.0-py3-none-any.whl (15.4 kB view hashes)

Uploaded Python 3

Supported by

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