Time_NLP icon indicating copy to clipboard operation
Time_NLP copied to clipboard

“9月10日到9月25日”第二个时间会识别成明年9月25日

Open jelly-FF opened this issue 4 years ago • 2 comments

请输入要识别的时间: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"]}

jelly-FF avatar Jul 06 '20 10:07 jelly-FF

应该是TimeUnit.py line 996 相等的情况没有写。 我暂时没有想到比较好的解决方案。

jelly-FF avatar Jul 06 '20 10:07 jelly-FF

换一个工具,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']}

dongrixinyu avatar Jul 26 '21 03:07 dongrixinyu