Time_NLP icon indicating copy to clipboard operation
Time_NLP copied to clipboard

解析晚上 8点半 返回时明天晚上8点

Open leewea opened this issue 5 years ago • 3 comments

temp ['晚上8点半'] {"type": "timestamp", "timestamp": "2019-05-13 20:30:00"} 2019-5-12-14-5-14 temp ['晚上9点半'] {"type": "timestamp", "timestamp": "2019-05-13 21:30:00"} 2019-5-12-14-5-14 temp ['8点半'] {"type": "timestamp", "timestamp": "2019-05-13 08:30:00"} 2019-5-12-14-5-14 temp ['2月28日11点半'] {"type": "timestamp", "timestamp": "2020-02-28 11:30:00"}

leewea avatar May 12 '19 06:05 leewea

同样的问题

2019-7-23-11-15-58 temp ['晚上8点'] {"type": "timestamp", "timestamp": "2019-07-24 20:00:00"}

nfzcl avatar Jul 23 '19 05:07 nfzcl

TimeNormalizer(isPreferFuture=True):

对于下午两点、晚上十点这样的词汇,在不特别指明的情况下,默认返回明天的时间点。 把isPreferFuture 设为 False 即可

bytemain avatar Jul 28 '19 09:07 bytemain

TimeNormalizer(isPreferFuture=True):

对于下午两点、晚上十点这样的词汇,在不特别指明的情况下,默认返回明天的时间点。 把isPreferFuture 设为 False 即可

在isPreferFuture为True的情况下,今天上午10点说的晚上8点也应该指的是今天晚上8点,而不应该是明天晚上8点(目前会返回明天晚上8点)。 从代码看,TimeUnit.norm_sethour()第211行是否应该先对“早上,下午,晚上”这些关键词进行判断,对小时数进行24小时制转换后,再调用self.preferFuture(3)。

jelly-FF avatar Dec 18 '19 09:12 jelly-FF