本文整理了Java中edu.illinois.cs.cogcomp.core.datastructures.textannotation.TextAnnotation.getId()
方法的一些代码示例,展示了TextAnnotation.getId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextAnnotation.getId()
方法的具体详情如下:
包路径:edu.illinois.cs.cogcomp.core.datastructures.textannotation.TextAnnotation
类名称:TextAnnotation
方法名:getId
暂无
代码示例来源:origin: CogComp/cogcomp-nlp
public String getCommaID() {
return commaPosition + " " + s.goldTa.getId();
}
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-comma
public String getCommaID() {
return commaPosition + " " + s.goldTa.getId();
}
代码示例来源:origin: CogComp/cogcomp-nlp
public String getId() {
return commas.get(0).getTextAnnotation(true).getId();
}
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-comma
public String getId() {
return commas.get(0).getTextAnnotation(true).getId();
}
代码示例来源:origin: CogComp/cogcomp-nlp
public void RunPipelineWithCorpusReader(AnnotationReader reader) {
Iterator<TextAnnotation> iter = reader.iterator();
boolean replaceExistingViews = false;
while (iter.hasNext()) {
TextAnnotation ta = iter.next();
try {
ta = pipeline.annotateTextAnnotation(ta, replaceExistingViews);
} catch (AnnotatorException e) {
e.printStackTrace();
logger.error("failed to preprocess ta with id '" + ta.getId() + "'.");
}
logger.debug("processed file (assumed this is TextAnnotation docid): '" + ta.getId()
+ "'");
}
}
代码示例来源:origin: CogComp/cogcomp-nlp
@Override
public final TextAnnotation next() {
TextAnnotation ta;
if (wsjIterator == null)
ta = super.next();
else
ta = wsjIterator.next();
assert ta != null;
if (this.goldFields.containsKey(ta.getId()))
addAnnotation(ta);
return ta;
}
代码示例来源:origin: CogComp/cogcomp-nlp
@Override
public final TextAnnotation next() {
TextAnnotation ta;
if (wsjIterator == null)
ta = super.next();
else
ta = wsjIterator.next();
assert ta != null;
if (this.goldFields.containsKey(ta.getId()))
addAnnotation(ta);
return ta;
}
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-nlp-pipeline
public void RunPipelineWithCorpusReader(AnnotationReader reader) {
Iterator<TextAnnotation> iter = reader.iterator();
boolean replaceExistingViews = false;
while (iter.hasNext()) {
TextAnnotation ta = iter.next();
try {
ta = pipeline.annotateTextAnnotation(ta, replaceExistingViews);
} catch (AnnotatorException e) {
e.printStackTrace();
logger.error("failed to preprocess ta with id '" + ta.getId() + "'.");
}
logger.debug("processed file (assumed this is TextAnnotation docid): '" + ta.getId()
+ "'");
}
}
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-verbsense
@Override
public final TextAnnotation next() {
TextAnnotation ta;
if (wsjIterator == null)
ta = super.next();
else
ta = wsjIterator.next();
assert ta != null;
if (this.goldFields.containsKey(ta.getId()))
addAnnotation(ta);
return ta;
}
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-corpusreaders
@Override
public final TextAnnotation next() {
TextAnnotation ta;
if (wsjIterator == null)
ta = super.next();
else
ta = wsjIterator.next();
assert ta != null;
if (this.goldFields.containsKey(ta.getId()))
addAnnotation(ta);
return ta;
}
代码示例来源:origin: CogComp/cogcomp-nlp
static public void printTextAnnotation(PrintStream out, TextAnnotation ta) {
out.println("TextAnnotation with id: " + ta.getId());
String rawText = ta.getText();
out.println("Raw Text: " + rawText);
out.println(getLineFill());
out.println("TextAnnotation Views:");
for (String name : ta.getAvailableViews()) {
out.println("View Name: " + name);
out.println(ta.getView(name).toString());
out.println(getLineFill());
}
}
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-core-utilities
static public void printTextAnnotation(PrintStream out, TextAnnotation ta) {
out.println("TextAnnotation with id: " + ta.getId());
String rawText = ta.getText();
out.println("Raw Text: " + rawText);
out.println(getLineFill());
out.println("TextAnnotation Views:");
for (String name : ta.getAvailableViews()) {
out.println("View Name: " + name);
out.println(ta.getView(name).toString());
out.println(getLineFill());
}
}
代码示例来源:origin: CogComp/cogcomp-nlp
public static void main(String[] args) throws Exception {
String corpusDirectory = "/shared/corpora/corporaWeb/written/eng/MASC-3.0.0/xces";
String outputDirectory = "/shared/corpora/corporaWeb/written/eng/MASC-3.0.0/json";
if (args.length >= 2) {
corpusDirectory = args[0];
outputDirectory = args[1];
}
MascXCESReader reader = new MascXCESReader("MASC-3.0.0", corpusDirectory, ".xml");
for (TextAnnotation ta : reader) {
String outputFile = Paths.get(outputDirectory, ta.getId() + ".json").toAbsolutePath().toString();
new File(outputFile).getParentFile().mkdirs();
SerializationHelper.serializeTextAnnotationToFile(ta, outputFile, true, true);
logger.info("Serialized TextAnnotation to [" + outputFile + "]");
}
System.out.print(reader.generateReport());
}
}
代码示例来源:origin: CogComp/talen
/**
* A little convenience function.
*
* @param sent
* @return
*/
public static String getSentId(Constituent sent) {
return sent.getTextAnnotation().getId() + ":" + sent.getSentenceId();
}
代码示例来源:origin: CogComp/talen
public static String getHTMLfromTA(TextAnnotation ta, Dictionary dict, boolean showdefs) {
return getHTMLfromTA(ta, new IntPair(-1, -1), ta.getId(), "", dict, showdefs, false, false);
}
代码示例来源:origin: CogComp/talen
public static String getHTMLfromTA(TextAnnotation ta, String query, Dictionary dict, boolean showdefs) {
return getHTMLfromTA(ta, new IntPair(-1, -1), ta.getId(), query, dict, showdefs, false, false);
}
代码示例来源:origin: CogComp/talen
public static String getHTMLfromTA(TextAnnotation ta, Dictionary dict, boolean showdefs, boolean showroman, boolean allowcopy) {
return getHTMLfromTA(ta, new IntPair(-1, -1), ta.getId(), "", dict, showdefs, showroman, allowcopy);
}
代码示例来源:origin: CogComp/talen
public static String getHTMLfromTA(TextAnnotation ta, Dictionary dict, boolean showdefs, boolean showroman) {
return getHTMLfromTA(ta, new IntPair(-1, -1), ta.getId(), "", dict, showdefs, showroman, false);
}
代码示例来源:origin: CogComp/cogcomp-nlp
static void checkLength(TextAnnotation textAnnotation,
boolean throwExceptionOnSentenceLengthCheck, int maxParseSentenceLength)
throws AnnotatorException {
if (throwExceptionOnSentenceLengthCheck) {
Constituent c =
HandlerUtils.checkTextAnnotationRespectsSentenceLengthLimit(textAnnotation,
maxParseSentenceLength);
if (null != c) {
String msg =
HandlerUtils.getSentenceLengthError(textAnnotation.getId(),
c.getSurfaceForm(), maxParseSentenceLength);
logger.error(msg);
throw new AnnotatorException(msg);
}
}
}
代码示例来源:origin: edu.illinois.cs.cogcomp/stanford_3.3.1
static void checkLength(TextAnnotation textAnnotation,
boolean throwExceptionOnSentenceLengthCheck, int maxParseSentenceLength)
throws AnnotatorException {
if (throwExceptionOnSentenceLengthCheck) {
Constituent c =
HandlerUtils.checkTextAnnotationRespectsSentenceLengthLimit(textAnnotation,
maxParseSentenceLength);
if (null != c) {
String msg =
HandlerUtils.getSentenceLengthError(textAnnotation.getId(),
c.getSurfaceForm(), maxParseSentenceLength);
logger.error(msg);
throw new AnnotatorException(msg);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!