/** * 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); } }
/** 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
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!" );
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);
public void execute() throws ExecutionException { if(gazetteerInst == null) { throw new ExecutionException( "No Gazetteer Provided!"); } if(document == null) { throw new ExecutionException( "No document to process!"); } if(inputFeatureNames == null || inputFeatureNames.size() == 0) { throw new ExecutionException( "No input feature names provided!"); } throw new ExecutionException("Temporary document cannot be created", rie); throw new ExecutionException("Error duplicating Input annotations", e);
private void transferAnnotations(List<Annotation> toTransfer, AnnotationSet to, boolean newID) throws ExecutionException { for(Annotation annot : toTransfer) { Mapping m = mappings.get(annot.getType()); String name = (m == null || m.newName == null ? annot.getType() : m.newName); try { FeatureMap params = Factory.newFeatureMap(); params.putAll(annot.getFeatures()); if(newID) { to.add(annot.getStartNode().getOffset(), annot.getEndNode() .getOffset(), name, params); } else { to.add(annot.getId(), annot.getStartNode().getOffset(), annot .getEndNode().getOffset(), name, params); } } catch(InvalidOffsetException e) { throw new ExecutionException(e); } } }
throw new ExecutionException(e); } finally { gazetteer.setDocument(null); throw new ExecutionException(e); } finally { transducer.setDocument(null); Factory.newFeatureMap()); }catch(InvalidOffsetException ioe){ throw new ExecutionException(ioe);
throw new ExecutionException("The execution of the \"" + getName() + "\" tokeniser has been abruptly interrupted!", e); } finally { throw new ExecutionException("The execution of the \"" + getName() + "\" tokeniser has been abruptly interrupted!", e); } finally {