本文整理了Java中edu.illinois.cs.cogcomp.core.datastructures.textannotation.TextAnnotation.addView()
方法的一些代码示例,展示了TextAnnotation.addView()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextAnnotation.addView()
方法的具体详情如下:
包路径:edu.illinois.cs.cogcomp.core.datastructures.textannotation.TextAnnotation
类名称:TextAnnotation
方法名:addView
[英]Adds a view that is generated by a Annotator
[中]添加由注释器生成的视图
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-depparse
TextAnnotation annotate(String corpusId, String sentId, String[] tokens)
throws AnnotatorException {
// Ignore the root token
List<String[]> words =
Collections.singletonList(Arrays.copyOfRange(tokens, 1, tokens.length));
TextAnnotation ta =
BasicTextAnnotationBuilder.createTextAnnotationFromTokens(corpusId, sentId, words);
ta.addView(pos);
ta.addView(lemma);
ta.addView(chunk);
return ta;
}
代码示例来源:origin: CogComp/cogcomp-nlp
@Override
protected void addView(TextAnnotation textAnnotation) throws AnnotatorException {
try {
textAnnotation.addView(viewName, labeler.getPrediction(textAnnotation));
} catch (Exception e) {
e.printStackTrace();
}
}
}
代码示例来源:origin: CogComp/cogcomp-nlp
private void annotateTas(){
for (TextAnnotation ta : taList){
POSAnnotator posAnnotator = new POSAnnotator();
try {
ta.addView(posAnnotator);
}
catch (Exception e){
e.printStackTrace();
}
}
}
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-verbsense
@Override
protected void addView(TextAnnotation textAnnotation) throws AnnotatorException {
try {
textAnnotation.addView(viewName, labeler.getPrediction(textAnnotation));
} catch (Exception e) {
e.printStackTrace();
}
}
}
代码示例来源:origin: edu.illinois.cs.cogcomp/md
private void annotateTas(){
for (TextAnnotation ta : taList){
POSAnnotator posAnnotator = new POSAnnotator();
try {
ta.addView(posAnnotator);
}
catch (Exception e){
e.printStackTrace();
}
}
}
代码示例来源:origin: CogComp/cogcomp-nlp
private void addPOSView(List<String> pos, TextAnnotation ta) {
// POS View
TokenLabelView posView = new TokenLabelView(ViewNames.POS, "GoldStandard", ta, 1.0);
for (int j = 0; j < pos.size(); j++)
posView.addTokenLabel(j, pos.get(j), 1.0);
ta.addView(ViewNames.POS, posView);
}
代码示例来源:origin: CogComp/cogcomp-nlp
private void populateTokenLabelView(TextAnnotation ta, List<String> tags, String viewName) {
TokenLabelView v = new TokenLabelView(viewName, ta);
for (int tkid = 0; tkid < tags.size(); tkid++)
v.addTokenLabel(tkid, tags.get(tkid), 1.0D);
ta.addView(viewName, v);
}
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-corpusreaders
private void addPOSView(List<String> pos, TextAnnotation ta) {
// POS View
TokenLabelView posView = new TokenLabelView(ViewNames.POS, "GoldStandard", ta, 1.0);
for (int j = 0; j < pos.size(); j++)
posView.addTokenLabel(j, pos.get(j), 1.0);
ta.addView(ViewNames.POS, posView);
}
代码示例来源:origin: CogComp/cogcomp-nlp
@Override
public void addView(TextAnnotation ta) throws AnnotatorException {
try {
ta.addView(viewName, curatorClient.getTextAnnotationView(ta, viewName));
} catch (TException | AnnotationFailedException | SocketException
| ServiceUnavailableException e) {
throw new AnnotatorException(e.getMessage());
}
}
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-curator
@Override
public void addView(TextAnnotation ta) throws AnnotatorException {
try {
ta.addView(viewName, curatorClient.getTextAnnotationView(ta, viewName));
} catch (TException | AnnotationFailedException | SocketException
| ServiceUnavailableException e) {
throw new AnnotatorException(e.getMessage());
}
}
代码示例来源:origin: CogComp/cogcomp-nlp
@Override
public void addView(TextAnnotation ta) throws AnnotatorException {
// Check if all required views are present
try {
View srlView = getSRL(ta);
ta.addView(getViewName(), srlView);
} catch (Exception e) {
e.printStackTrace();
throw new AnnotatorException(e.getMessage());
}
}
}
代码示例来源:origin: edu.illinois.cs.cogcomp/saul-examples
private void addView(TextAnnotation ta, List<String> labels) {
TokenLabelView labelView = new TokenLabelView(viewName, ta);
List constituents = ta.getView(ViewNames.TOKENS).getConstituents();
assert constituents.size() == labels.size();
for (int i = 0; i < constituents.size(); ++i) {
Constituent constituent = (Constituent) constituents.get(i);
labelView.addTokenLabel(constituent.getStartSpan(), labels.get(i), 1.0D);
}
ta.addView(viewName, labelView);
}
代码示例来源:origin: edu.illinois.cs.cogcomp/esrl-core
protected void addGoldPOSView(TextAnnotation ta, List<String> sentencePOS) {
TokenLabelView posView = new TokenLabelView(ViewNames.POS, ta);
List constituents = ta.getView(ViewNames.TOKENS).getConstituents();
assert constituents.size() == sentencePOS.size();
for (int i = 0; i < constituents.size(); ++i) {
Constituent constituent = (Constituent) constituents.get(i);
posView.addTokenLabel(constituent.getStartSpan(), sentencePOS.get(i), 1.0D);
}
ta.addView(ViewNames.POS, posView);
}
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-quantifier
protected void addGoldPOSView(TextAnnotation ta, List<String> sentencePOS) {
TokenLabelView posView = new TokenLabelView(ViewNames.POS, ta);
List<Constituent> constituents = ta.getView(ViewNames.TOKENS).getConstituents();
assert constituents.size() == sentencePOS.size();
for (int i = 0; i < constituents.size(); ++i) {
Constituent constituent = (Constituent) constituents.get(i);
posView.addTokenLabel(constituent.getStartSpan(), sentencePOS.get(i), 1.0D);
}
ta.addView(ViewNames.POS, posView);
}
代码示例来源:origin: CogComp/cogcomp-nlp
public void addView(TextAnnotation ta, boolean overwrite) {
TextAnnotation newTA = null;
try {
newTA = annotate(ta.getText(), overwrite);
} catch (Exception e) {
e.printStackTrace();
}
for (String vu : viewsToAdd) {
ta.addView(vu, newTA.getView(vu));
}
}
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-pipeline-client
public void addView(TextAnnotation ta, boolean overwrite) {
TextAnnotation newTA = null;
try {
newTA = annotate(ta.getText(), overwrite);
} catch (Exception e) {
e.printStackTrace();
}
for (String vu : viewsToAdd) {
ta.addView(vu, newTA.getView(vu));
}
}
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-corpusreaders
private void addParseView(List<String> parses, TextAnnotation ta) {
// PARSE View
TreeView parseView = new TreeView(ViewNames.PARSE_CHARNIAK, "GoldStandard", ta, 1.0);
for (int j = 0; j < parses.size(); j++) {
Tree<String> parseTree = TreeParserFactory.getStringTreeParser().parse(parses.get(j));
parseView.setParseTree(j, parseTree);
}
ta.addView(ViewNames.PARSE_CHARNIAK, parseView);
}
代码示例来源:origin: CogComp/cogcomp-nlp
protected void addGoldView(TextAnnotation ta, List<String> labels) {
TokenLabelView posView = new TokenLabelView(viewName, ta);
List<Constituent> constituents = ta.getView(ViewNames.TOKENS).getConstituents();
for (int i = 0; i < constituents.size(); ++i) {
Constituent constituent = (Constituent) constituents.get(i);
posView.addTokenLabel(constituent.getStartSpan(), labels.get(i), 1.0D);
}
ta.addView(viewName, posView);
}
}
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-quantifier
protected void addGoldView(TextAnnotation ta, List<String> labels) {
TokenLabelView posView = new TokenLabelView(viewName, ta);
List<Constituent> constituents = ta.getView(ViewNames.TOKENS).getConstituents();
for (int i = 0; i < constituents.size(); ++i) {
Constituent constituent = (Constituent) constituents.get(i);
posView.addTokenLabel(constituent.getStartSpan(), labels.get(i), 1.0D);
}
ta.addView(viewName, posView);
}
}
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-edison
@Override
public void addView(TextAnnotation input) {
TokenLabelView view = new TokenLabelView(getViewName(), "PorterStemmer", input, 1.0);
synchronized (instance) {
for (int i = 0; i < input.size(); i++) {
stemmer.setCurrent(input.getToken(i));
stemmer.stem();
view.addTokenLabel(i, stemmer.getCurrent(), 1.0);
}
}
input.addView(getViewName(), view);
}
内容来源于网络,如有侵权,请联系作者删除!