/** * Gets the content of an annotation */ public static String getStringForSpan(Long start, Long end,gate.Document d) throws ExecutionException { try { return d.getContent().getContent(start, end).toString(); } catch (InvalidOffsetException e) { //log.error("Weird offset exception in getStringForSpan", e); throw new ExecutionException(e); } }
private void addToOriginal(AnnotationSet original, long originalStart, long originalEnd, long tempStart, long tempEnd, Annotation tempLookup, Document tempDoc) throws ExecutionException { try { original.add(originalStart, originalEnd, tempLookup.getType(), tempLookup.getFeatures()); } catch(InvalidOffsetException ioe) { String errorDetails = String.format("temp %d, %d [%s]-> original %d, %d ", tempStart, tempEnd, Utils.stringFor(tempDoc, tempLookup), originalStart, originalEnd); throw new ExecutionException(errorDetails, ioe); } }
@Override public void execute() throws ExecutionException { if(document == null) throw new ExecutionException("Document is null!"); annotationSet = document.getAnnotations(annotationSetName); String s = document.getContent().toString() + " ";
throw new ExecutionException("No document to process!"); throw new ExecutionException("No gazetteer set!");
throw new ExecutionException("Corpus cannot be null or empty"); throw new ExecutionException( "Please provide at least one annotation type to compare"); throw new ExecutionException("No measure selected"); if(!outputFolder.exists()) { if(!outputFolder.mkdirs()) { throw new ExecutionException("Could not create a folder : " + outputFolder.getAbsolutePath()); throw new ExecutionException("Invalid directory : " + outputFolder.getAbsolutePath()); throw new ExecutionException(iue); throw new ExecutionException(use); throw new ExecutionException(e); throw new ExecutionException(ioe); throw new ExecutionException(e);
/** * Implementation of the run() method from {@link java.lang.Runnable}. This * method is responsible for doing all the processing of the input document. */ @Override public void execute() throws ExecutionException { interrupted = false; if(document == null) throw new ExecutionException("No document provided!"); if(inputASName != null && inputASName.equals("")) inputASName = null; if(outputASName != null && outputASName.equals("")) outputASName = null; // the action context always reflects, for each document executed, // the current PR features and the corpus, if present actionContext.setCorpus(corpus); actionContext.setPRFeatures(features); actionContext.setPR(this); try { batch.transduce(document, inputASName == null ? document.getAnnotations() : document.getAnnotations(inputASName), outputASName == null ? document.getAnnotations() : document.getAnnotations(outputASName)); } catch(JapeException je) { throw new ExecutionException(je); } }
@Override public void execute() throws ExecutionException{ if(document == null) throw new ExecutionException( "No document to process!"); if(inputASName != null && inputASName.equals("")) inputASName = null; throw new ExecutionException("No base Token Annotation Type provided!"); throw new ExecutionException("No base Sentence Annotation Type provided!"); throw new ExecutionException("No AnnotationType provided to store the new feature!"); throw new ExecutionException( "POS Tagger malfunction: the output size (" + taggerResults.size() + throw new ExecutionException( "POS Tagger malfunction: the output size (" + taggerResults.size() + }else{ if(failOnMissingInputAnnotations) { throw new ExecutionException("No sentences or tokens to process in document "+document.getName()+"\n" + "Please run a sentence splitter "+ "and tokeniser first!");
/** Executes this onto gazetteer over a pre-set document * @throws ExecutionException if something goes wrong with the execution */ @Override public void execute()throws ExecutionException { if (null == gaz) { throw new ExecutionException("gazetteer not initialized (null)."); } gaz.setDocument(document); gaz.setAnnotationSetName(annotationSetName); gaz.setEncoding(encoding); gaz.setCorpus(corpus); gaz.execute(); } // execute
} catch(InvalidOffsetException e) { throw new ExecutionException(e); } catch(InvalidOffsetException e) { throw new ExecutionException(e); throw new ExecutionException("Invalid state - cannot identify match!");
throw new ExecutionException("Invalid offset of the annotation");
throw new ExecutionException("[coreference] Document is not set!");
throw new ExecutionException( "No document for namematch!" );
throw new ExecutionException( "No document to process!" );
throw new ExecutionException("[coreference] Document is not set!");
throw new ExecutionException( "No document to tokenise!" );
fireProcessFinished(); if(failOnMissingInputAnnotations) { throw new ExecutionException("Either "+document.getName()+" does not have any contents or \n run the POS Tagger first and then Morpher"); } else { Utils.logOnce(logger,Level.INFO,"Morphological analyser: either a document does not have any contents or run the POS Tagger first - see debug log for details."); fireProcessFinished(); if(failOnMissingInputAnnotations) { throw new ExecutionException("please run the POS Tagger first and then Morpher"); } else { Utils.logOnce(logger,Level.INFO,"Morphological analyser: no input annotations, run the POS Tagger first - see debug log for details.");
throw new ExecutionException("No tokens to process in document " + document.getName() + "\n" + "Please run a tokeniser first!"); throw new ExecutionException(rie);
throw new ExecutionException( "Couldn't run controller aborted action", e);
throw new ExecutionException( "Couldn't run controller started action", e);
throw new ExecutionException( "Couldn't run controller finished action", e);