本文整理汇总了Java中gate.creole.ExecutionInterruptedException类的典型用法代码示例。如果您正苦于以下问题:Java ExecutionInterruptedException类的具体用法?Java ExecutionInterruptedException怎么用?Java ExecutionInterruptedException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExecutionInterruptedException类属于gate.creole包,在下文中一共展示了ExecutionInterruptedException类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: parseSentences
点赞 3
import gate.creole.ExecutionInterruptedException; //导入依赖的package包/类
/**
* Find all the Sentence annotations and iterate through them, parsing one
* sentence at a time and storing the result in the output AS. (Sentences are
* scanned for Tokens. You have to run the ANNIE tokenizer and splitter before
* this PR.)
* @throws ExecutionInterruptedException
*/
private void parseSentences(AnnotationSet annotationSet) throws ExecutionInterruptedException {
List<Annotation> sentences = gate.Utils.inDocumentOrder(annotationSet.get(inputSentenceType));
int sentencesDone = 0;
int nbrSentences = sentences.size();
for (Annotation sentence : sentences) {
parseOneSentence(annotationSet, sentence, sentencesDone, nbrSentences);
sentencesDone++;
checkInterruption();
}
sentencesDone++;
fireProgressChanged((int)(100 * sentencesDone / nbrSentences));
}
开发者ID:vita-us,
项目名称:ViTA,
代码行数:23,
代码来源:Parser.java
示例2: parseSentences
点赞 2
import gate.creole.ExecutionInterruptedException; //导入依赖的package包/类
/**
* Find all the Sentence annotations and iterate through them, parsing one
* sentence at a time and storing the result in the output AS. (Sentences are
* scanned for Tokens. You have to run the ANNIE tokenizer and splitter before
* this PR.)
*
* @throws ExecutionInterruptedException
*/
private void parseSentences(AnnotationSet annotationSet)
throws ExecutionInterruptedException {
List<Annotation> sentences =
gate.Utils.inDocumentOrder(annotationSet.get(inputSentenceType));
int sentencesDone = 0;
int nbrSentences = sentences.size();
for(Annotation sentence : sentences) {
parseOneSentence(annotationSet, sentence, sentencesDone, nbrSentences);
sentencesDone++;
checkInterruption();
}
sentencesDone++;
fireProgressChanged(100 * sentencesDone / nbrSentences);
}
开发者ID:GateNLP,
项目名称:gateplugin-Stanford_CoreNLP,
代码行数:23,
代码来源:Parser.java
示例3: parseOneSentence
点赞 2
import gate.creole.ExecutionInterruptedException; //导入依赖的package包/类
/**
* Generate the special data structure for one sentence and pass the List of
* Word to the parser. Apply the annotations back to the document.
*
* @param sentence
* the Sentence annotation
* @param s
* sentence number of debugging output
* @param ofS
* total number of sentences for debugging output
* @return null if the sentence is empty
* @throws ExecutionInterruptedException
*/
private void parseOneSentence(AnnotationSet annotationSet,
Annotation sentence, int sentCtr, int sentCount)
throws ExecutionInterruptedException {
Tree tree;
StanfordSentence stanfordSentence =
new StanfordSentence(sentence, inputTokenType, annotationSet,
reusePosTags);
if(debugMode) {
System.out.println(stanfordSentence.toString());
}
/*
* Ignore an empty Sentence (sometimes the regex splitter can create one
* with no Token annotations in it).
*/
if(stanfordSentence.isNotEmpty()) {
List<Word> wordList = stanfordSentence.getWordList();
if(reusePosTags) {
int nbrMissingTags = stanfordSentence.numberOfMissingPosTags();
if(nbrMissingTags > 0) {
double percentMissing =
Math.ceil(100.0 * (nbrMissingTags)
/ (stanfordSentence.numberOfTokens()));
System.err.println("Warning (sentence " + sentCtr + "): "
+ (int)percentMissing + "% of the Tokens are missing POS tags.");
}
}
tree = stanfordParser.parse(wordList);
checkInterruption();
if(addConstituentAnnotations || addPosTags) {
annotatePhraseStructureRecursively(annotationSet, stanfordSentence,
tree, tree);
}
checkInterruption();
if(addDependencyFeatures || addDependencyAnnotations) {
annotateDependencies(annotationSet, stanfordSentence, tree);
}
if(debugMode) {
System.out.println("Parsed sentence " + sentCtr + " of " + sentCount);
}
} else if(debugMode) {
System.out.println("Ignored empty sentence " + sentCtr + " of "
+ sentCount);
}
}
开发者ID:GateNLP,
项目名称:gateplugin-Stanford_CoreNLP,
代码行数:58,
代码来源:Parser.java
示例4: checkInterruption
点赞 2
import gate.creole.ExecutionInterruptedException; //导入依赖的package包/类
private void checkInterruption() throws ExecutionInterruptedException {
if(isInterrupted()) { throw new ExecutionInterruptedException(
"Execution of " + this.getName() + " has been abruptly interrupted!"); }
}
开发者ID:GateNLP,
项目名称:gateplugin-Stanford_CoreNLP,
代码行数:5,
代码来源:Parser.java
示例5: parseOneSentence
点赞 2
import gate.creole.ExecutionInterruptedException; //导入依赖的package包/类
/**
* Generate the special data structure for one sentence and pass the List of
* Word to the parser. Apply the annotations back to the document.
*
* @param sentence
* the Sentence annotation
* @param s
* sentence number of debugging output
* @param ofS
* total number of sentences for debugging output
* @return null if the sentence is empty
* @throws ExecutionInterruptedException
*/
private void parseOneSentence(AnnotationSet annotationSet, Annotation sentence, int sentCtr, int sentCount) throws ExecutionInterruptedException {
Tree tree;
StanfordSentence stanfordSentence = new StanfordSentence(sentence, inputTokenType, annotationSet, reusePosTags);
if (debugMode) {
System.out.println(stanfordSentence.toString());
}
/* Ignore an empty Sentence (sometimes the regex splitter can create one
* with no Token annotations in it).
*/
if ( stanfordSentence.isNotEmpty() ) {
List<Word> wordList = stanfordSentence.getWordList();
if (reusePosTags) {
int nbrMissingTags = stanfordSentence.numberOfMissingPosTags();
if (nbrMissingTags > 0) {
double percentMissing = Math.ceil(100.0 * ((float) nbrMissingTags) /
((float) stanfordSentence.numberOfTokens()) );
System.err.println("Warning (sentence " + sentCtr + "): " + (int) percentMissing
+ "% of the Tokens are missing POS tags." );
}
}
tree = stanfordParser.parseTree(wordList);
checkInterruption();
if (addConstituentAnnotations || addPosTags) {
annotatePhraseStructureRecursively(annotationSet, stanfordSentence, tree, tree);
}
checkInterruption();
if (addDependencyFeatures || addDependencyAnnotations) {
annotateDependencies(annotationSet, stanfordSentence, tree);
}
if (debugMode) {
System.out.println("Parsed sentence " + sentCtr + " of " + sentCount);
}
}
else if (debugMode) {
System.out.println("Ignored empty sentence " + sentCtr + " of " + sentCount);
}
}
开发者ID:vita-us,
项目名称:ViTA,
代码行数:59,
代码来源:Parser.java