本文整理匯總了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());
}