Time_NLP
Time_NLP copied to clipboard
“9月10日到9月25日”第二个时间会识别成明年9月25日
请输入要识别的时间:9月10日到9月25日 当前时间:2020-07-06 17:32:28 {"type": "timespan", "timespan": ["2020-09-10 00:00:00", "2021-09-25 00:00:00"]}
应该是TimeUnit.py line 996 相等的情况没有写。 我暂时没有想到比较好的解决方案。
换一个工具,JioNLP
import jionlp as jio
import time
text = '9月10日到9月25日'
print(jio.parse_time(text, time_base=time.time()))
# {'type': 'time_span', 'definition': 'accurate', 'time': ['2021-09-10 00:00:00', '2021-09-25 23:59:59']}