本文整理汇总了Java中edu.uw.easysrl.main.InputReader.InputToParser方法的典型用法代码示例。如果您正苦于以下问题:Java InputReader.InputToParser方法的具体用法?Java InputReader.InputToParser怎么用?Java InputReader.InputToParser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.uw.easysrl.main.InputReader
的用法示例。
在下文中一共展示了InputReader.InputToParser方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parse
import edu.uw.easysrl.main.InputReader; //导入方法依赖的package包/类
@Override
public Parse parse(int sentenceId, List<InputReader.InputWord> sentence) {
final InputReader.InputToParser input = taggedSentences == null ?
new InputReader.InputToParser(sentence, null, null, false) :
new InputReader.InputToParser(sentence, null, taggedSentences.get(sentenceId), true);
List<Scored<SyntaxTreeNode>> parses = parser.doParsing(input);
if (parses == null || parses.size() == 0) {
System.err.println("Unable to parse:\t" + taggedSentences);
return null;
}
return getParse(sentence, parses.get(0), dependencyGenerator);
}
示例2: parseNBest
import edu.uw.easysrl.main.InputReader; //导入方法依赖的package包/类
@Override
public List<Parse> parseNBest(int sentenceId, List<InputReader.InputWord> sentence) {
final InputReader.InputToParser input = taggedSentences == null ?
new InputReader.InputToParser(sentence, null, null, false) :
new InputReader.InputToParser(sentence, null, taggedSentences.get(sentenceId), true);
if (taggedSentences.get(sentenceId).size() == 0) {
System.err.println("Untagged sentence:\t" + sentenceId);
return null;
}
List<Scored<SyntaxTreeNode>> parses = parser.doParsing(input);
if (parses == null || parses.size() == 0) {
return null;
}
return parses.stream().map(p -> getParse(sentence, p, dependencyGenerator)).collect(Collectors.toList());
}
示例3: parseWithConstraint
import edu.uw.easysrl.main.InputReader; //导入方法依赖的package包/类
public Parse parseWithConstraint(int sentenceId, List<InputReader.InputWord> sentence,
Set<Constraint> constraintSet) {
if (sentence.size() > maxSentenceLength) {
System.err.println("Skipping sentence of length " + sentence.size());
return null;
}
final InputReader.InputToParser input = taggedSentences == null ?
new InputReader.InputToParser(sentence, null, null, false) :
new InputReader.InputToParser(sentence, null, taggedSentences.get(sentenceId), true);
List<Scored<SyntaxTreeNode>> parses = parser.parseWithConstraints(input, constraintSet);
return (parses == null || parses.size() == 0) ? null :
getParse(sentence, parses.get(0), dependencyGenerator);
}
示例4: parseNBestWithConstraint
import edu.uw.easysrl.main.InputReader; //导入方法依赖的package包/类
public List<Parse> parseNBestWithConstraint(int sentenceId, List<InputReader.InputWord> sentence,
Set<Constraint> constraintSet) {
if (sentence.size() > maxSentenceLength) {
System.err.println("Skipping sentence of length " + sentence.size());
return null;
}
final InputReader.InputToParser input = taggedSentences == null ?
new InputReader.InputToParser(sentence, null, null, false) :
new InputReader.InputToParser(sentence, null, taggedSentences.get(sentenceId), true);
List<Scored<SyntaxTreeNode>> parses = parser.parseWithConstraints(input, constraintSet);
return (parses == null || parses.size() == 0) ? null :
parses.stream().map(p -> getParse(sentence, p, dependencyGenerator)).collect(Collectors.toList());
}