JioNLP icon indicating copy to clipboard operation
JioNLP copied to clipboard

“双时间范围组成的时间周期”日期时间提取失败

Open PerfectWorld233 opened this issue 3 years ago • 1 comments

日期时间提取失败

import jionlp as jio
data = "报名时间:2022年8月1日(星期一)至8月5日(星期五),上午8:30-12:00,下午14:00"
res = jio.parse_time(data)
print(res)

`Traceback (most recent call last): File "D:\anaconda\lib\site-packages\jionlp\gadget\time_parser.py", line 5157, in time_handler2standard_time second_time_string = TimeParser._convert_handler2datetime(second_handler) File "D:\anaconda\lib\site-packages\jionlp\gadget\time_parser.py", line 5252, in _convert_handler2datetime return datetime.datetime( ValueError: month must be in 1..12

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "D:\PythonProject\job_nlp\test\nlp_time.py", line 19, in jio_nlp(data) File "D:\PythonProject\job_nlp\test\nlp_time.py", line 9, in jio_nlp res = jio.parse_time(data) File "D:\anaconda\lib\site-packages\jionlp\gadget\time_parser.py", line 835, in call first_standard_time_string, second_standard_time_string = self.time_handler2standard_time( File "D:\anaconda\lib\site-packages\jionlp\gadget\time_parser.py", line 5159, in time_handler2standard_time raise ValueError('the given time string is illegal.\n{}'.format( ValueError: the given time string is illegal. Traceback (most recent call last): File "D:\anaconda\lib\site-packages\jionlp\gadget\time_parser.py", line 5157, in time_handler2standard_time second_time_string = TimeParser._convert_handler2datetime(second_handler) File "D:\anaconda\lib\site-packages\jionlp\gadget\time_parser.py", line 5252, in _convert_handler2datetime return datetime.datetime( ValueError: month must be in 1..12`

PerfectWorld233 avatar Dec 12 '22 03:12 PerfectWorld233

讲真这个日期是两个时间范围组成的周期。逻辑上还挺复杂的。解决起来排期要靠后

dongrixinyu avatar Dec 13 '22 01:12 dongrixinyu