Time_NLP
Time_NLP copied to clipboard
解析晚上 8点半 返回时明天晚上8点
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"}
同样的问题
2019-7-23-11-15-58 temp ['晚上8点'] {"type": "timestamp", "timestamp": "2019-07-24 20:00:00"}
TimeNormalizer(isPreferFuture=True):
对于下午两点、晚上十点这样的词汇,在不特别指明的情况下,默认返回明天的时间点。 把isPreferFuture 设为 False 即可
TimeNormalizer(isPreferFuture=True):
对于下午两点、晚上十点这样的词汇,在不特别指明的情况下,默认返回明天的时间点。 把isPreferFuture 设为 False 即可
在isPreferFuture为True的情况下,今天上午10点说的晚上8点也应该指的是今天晚上8点,而不应该是明天晚上8点(目前会返回明天晚上8点)。 从代码看,TimeUnit.norm_sethour()第211行是否应该先对“早上,下午,晚上”这些关键词进行判断,对小时数进行24小时制转换后,再调用self.preferFuture(3)。