Skip to main content

xnlp_time

处理时间模块集合

安装

pip install xnlp-time

测试

from xnlp_time import TimeExtractor

time_ext = TimeExtractor()


def time_extractor_parse(query):
    """
    时间提取解析
    :param query:
    :return:
    """
    result = time_ext.parse(query)
    return result


if __name__ == '__main__':

    texts = [
        '去年的今天',
        '明天',
        '后天',
        '去年的五一',
        '去年的五月十一号',
        '明年的今天',
        '明年的十月一日',
        '腊月十三',
        '端午节',
        '十一',
        '劳动节',
        '植树节',
        '双十一',
        '元旦',
        '春节',
        '圣诞节',
        '元宵节',
        '正月十五',
        '八一',
        '六一',
        '儿童节',
        '妇女节',
        '万圣节',
        '大后天',
        '明后两天',
        '下午两点',
        '上午两点',
        '昨晚,前晚,明晚',
        '上月今天天气咋样',
        '昨天夜里两点',
        '大后天',
        '大前天',
        '腊八节'
    ]
    for text in texts:
        print('query:{},result:{}'.format(text, time_extractor_parse(text)))
    print("********the end********")

Release files for xnlp-time 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xnlp-time 1.0.3
File Size Uploaded
xnlp_time-1.0.3.tar.gz 11.6 kB Details

Release files / xnlp_time-1.0.3.tar.gz

Download URL xnlp_time-1.0.3.tar.gz
Size 11.6 kB
Tags Source
SHA-256 checksum
How to use checksums
34bcf87a9ca7480a28ed1aa9caedb81dfdd3349a2df6bf7a77db52c35b9835c5
BLAKE2b-256 checksum
How to use checksums
2d24a8a39a7a07b4bc1ba3bfa3ffaba4d09ea77b93ef6b1b20216c3e110036fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0.post20200518 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.10

Release history Release notifications | RSS feed

This release

1.0.3 This release

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page