Chinese to time, time to Chinese.
Project description
📦 nlp-time
Time NLP module
Installation
pip install -i https://mirrors.aliyun.com/pypi/simple/ --extra-index-url https://pypi.org/simple/ nlp-time
Example
import nlp_time
from datetime import datetime
# Partial replacement according to regular expression
res = nlp_time.get_time("我是周六早上6点的飞机")
# output: ('周六早上6点', ('2022-05-28 06:00:00', '2022-05-28 06:59:59'))
res = nlp_time.get_time("我是周六早上6点的飞机", tend_future=False)
# output: ('周六早上6点', ('2022-05-21 06:00:00', '2022-05-21 06:59:59'))
res = nlp_time.get_text(datetime.strptime("2022-05-22 20:06:00", "%Y-%m-%d %H:%M:%S"))
# output: 昨天晚上20点06分
res = nlp_time.get_text("2022-05-22 20:06:00")
# output: 昨天晚上20点06分
res = nlp_time.get_text("2021-05-22 20:06:00")
# output: 去年5月22号晚上20点06分
res = nlp_time.get_text(1653091200)
# output: 前天早上8点
res = nlp_time.get_text("2021-05-18 20:06:00")
# output: 上周三晚上20点06分
To Do
- Be the best version of you.
More Resources
- nlp-time on github.com
- Official Python Packaging User Guide
- The Hitchhiker's Guide to Packaging
- Cookiecutter template for a Python package
License
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
nlp-time-0.1.14.tar.gz
(6.4 kB
view details)
Built Distribution
File details
Details for the file nlp-time-0.1.14.tar.gz
.
File metadata
- Download URL: nlp-time-0.1.14.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43245719f155d891846c5bc6912a78e0e2dbc9902fda67b3a6b8216a5ee7e9b6 |
|
MD5 | b728deb70cafea0b391f70413e62de17 |
|
BLAKE2b-256 | ad44014c3f8e1b9f509d5807385427b45ffc50229a2ee70a428a98339a15fa9b |
File details
Details for the file nlp_time-0.1.14-py3-none-any.whl
.
File metadata
- Download URL: nlp_time-0.1.14-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d055772dc5eaadd2e781c8de6051975fc3b72a83e71dabcb6aa618fa10d78e83 |
|
MD5 | 78d6731dede9a533738211114fa4fc06 |
|
BLAKE2b-256 | 128be93c308cf5aa1afd5aa3e5e74b2f08fb2ebe9ea44433d43f7eff9158332e |