本文介绍了在StanfordCoreNLP中设置句子的最大长度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试限制StanfordCoreNLP中句子的最大长度.由于某些原因,它似乎不尊重该属性.该标志是LexicalizedParser的一部分.但是我在课堂上使用StanfordCoreNLP实例.想知道设置此标志的正确方法是什么.

I am trying to restrict the max length for a sentence in StanfordCoreNLP. For some reason it does not seem to honor this property. This flag is part of the LexicalizedParser. But I am using StanfordCoreNLP instance in my class. Wondering what is the right way to set this flag.

 Properties properties = new Properties();
 properties.put("annotators", "tokenize,ssplit,pos,lemma,ner");
 properties.put("-maxLength", "100"); // does not work
 StanfordCoreNLP nap = new StanfordCoreNLP(properties);

推荐答案

目前,CoreNLP没有通用的maxLength标志.各个注释器可能有一个类似parse.maxlen的注释器,但是如果句子太长,则意味着只跳过运行该注释器即可.

At present, CoreNLP has no general maxLength flag. Individual Annotators may have one like parse.maxlen, but if the sentence is too long, that means simply skipping running that annotator.

这篇关于在StanfordCoreNLP中设置句子的最大长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 21:18