Skip to main content

字符串时间解析

Project description

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********")

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

xnlp_time-1.0.3.tar.gz (11.6 kB view details)

Uploaded Source

File details

Details for the file xnlp_time-1.0.3.tar.gz.

File metadata

  • Download URL: xnlp_time-1.0.3.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for xnlp_time-1.0.3.tar.gz
Algorithm Hash digest
SHA256 34bcf87a9ca7480a28ed1aa9caedb81dfdd3349a2df6bf7a77db52c35b9835c5
MD5 514f1ac18ca0f0ed23cb9c34b829bcb1
BLAKE2b-256 2d24a8a39a7a07b4bc1ba3bfa3ffaba4d09ea77b93ef6b1b20216c3e110036fc

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