MiNLP
MiNLP copied to clipboard
“三分钟后” 精度丢失(inheritGrainOfDuration=false)
关闭粒度继承,query=“3分钟后”,默认值秒位精度丢失(second总是0)
复现代码如下
List<EnumeratedDimension> dims = Lists.newArrayList(EnumeratedDimension.Time, EnumeratedDimension.Duration);
Options base = new Options(dims, false);
options = new Options(false,
true,
false,
base.targets(),
false,
false,
base.rankOptions(),
new TimeOptions(false, true, true,false),
base.numeralOptions(),
base.timeout());
String raw="3分钟后";
Types.Context context = new Types.Context(ZonedDateTime.now(), Locale.CHINA);
List<Types.Answer> answers = Api.analyzeJ(raw, context, options);
Types.ResolvedValue value = answers.get(0).token().value();