CASDocument(CAS view, @Nullable LabelAdapters labelAdapters) { super(view.getViewName(), view.getDocumentText()); this.view = view; this.labelAdapters = labelAdapters; }
private void processView(CAS aCAS) { out.println("-------- View " + aCAS.getViewName() + " begin ----------------------------------"); out.println(); processDocumentMetadata(aCAS); processDocumentText(aCAS); processFeatureStructures(aCAS); out.println("-------- View " + aCAS.getViewName() + " end ----------------------------------"); out.println(); }
private void processView(CAS aCAS) { out.println("-------- View " + aCAS.getViewName() + " begin ----------------------------------"); out.println(); processDocumentMetadata(aCAS); processDocumentText(aCAS); processFeatureStructures(aCAS); out.println("-------- View " + aCAS.getViewName() + " end ----------------------------------"); out.println(); }
private void processView(CAS aCAS) { out.println("-------- View " + aCAS.getViewName() + " begin ----------------------------------"); out.println(); processDocumentMetadata(aCAS); processDocumentText(aCAS); processFeatureStructures(aCAS); out.println("-------- View " + aCAS.getViewName() + " end ----------------------------------"); out.println(); }
@Override public void switchView(String viewName) { String oldViewName = mCAS.getViewName(); mCAS = mCAS.getView(viewName); fireViewChanged(oldViewName, viewName); }
void traceFSfs(FeatureStructureImpl fs) { StringBuilder b = svd.traceFScreationSb; svd.traceFSid = fs.getAddress(); b.append("c:").append(String.format("%-3d", getCasId())); String viewName = fs.getCAS().getViewName(); if (null == viewName) { viewName = "base"; } b.append(" v:").append(MiscImpl.elide(viewName, 8)); b.append(" i:").append(String.format("%-5s", fs.getAddress())); b.append(" t:").append(MiscImpl.elide(fs.getType().getShortName(), 10)); }
@Override public void handleEvent(Event e) { // Trigger only if view is really changed // TODO: Move this check to the document itself ... if(!casEditor.getDocument().getCAS().getViewName().equals(viewName)) { casEditor.showView(viewName); } } });
/** * Does a deep copy of the contents of one CAS View into another CAS's same-named-view * If the destination view already exists in the destination CAS, * then it will be the target of the copy. Otherwise, a new view will be created with * that name and will become the target of the copy. All FeatureStructures * (except for those dropped because the target type system doesn't have the needed type) that are indexed * in the source CAS view will become indexed in the target view. * Cross-view references may result in creating additional views in the destination CAS; * for these views, any Sofa data in the source is *not* copied. * * @param aSrcCasView the CAS to copy from. This must be a view in the src Cas set by the constructor * @param aCopySofa if true, the sofa data and mimeType will be copied. If false they will not. */ public void copyCasView(CAS aSrcCasView, boolean aCopySofa) { copyCasViewDifferentCASs(aSrcCasView, getOrCreateView(originalTgtCas, aSrcCasView.getViewName()), aCopySofa); }
public static void apply(CAS cas, String script, Map<String, Object> parameters) throws IOException, InvalidXMLException, ResourceInitializationException, ResourceConfigurationException, AnalysisEngineProcessException, URISyntaxException { String viewName = cas.getViewName(); URL aedesc = RutaEngine.class.getResource("BasicEngine.xml"); AnalysisEngine ae = wrapAnalysisEngine(aedesc, viewName, null); File scriptFile = File.createTempFile("Ruta", RutaEngine.SCRIPT_FILE_EXTENSION); scriptFile.deleteOnExit(); FileUtils.saveString2File(script, scriptFile, "UTF-8"); ae.setConfigParameterValue(RutaEngine.PARAM_SCRIPT_PATHS, new String[] { scriptFile .getParentFile().getAbsolutePath() }); String name = scriptFile.getName().substring(0, scriptFile.getName().length() - 5); ae.setConfigParameterValue(RutaEngine.PARAM_MAIN_SCRIPT, name); if (parameters != null) { for (Map.Entry<String, Object> parameter : parameters.entrySet()) { ae.setConfigParameterValue(parameter.getKey(), parameter.getValue()); } } ae.reconfigure(); ae.process(cas); scriptFile.delete(); ae.destroy(); }
public static String annotationOffset(Annotation annotation) { return annotation.getView().getViewName() + ":" + annotation.getBegin() + ":" + annotation.getEnd(); }
System.out.print("Mention: " + member.getCoveredText().replace("\n", "<CR>")); sysEntChainMap.put(member, sysChainNum); if(!member.getView().getViewName().equals(docView.getViewName())){ System.out.print("[DOC:" + member.getView().getViewName() + "]");
private static JCas getViewWithGoldAnnotations(JCas correspondingCasThatHasGoldAnnotations) { JCas viewWithPreexistingGoldAnnotations = null; try { viewWithPreexistingGoldAnnotations = correspondingCasThatHasGoldAnnotations.getView(AssertionEvaluation.GOLD_VIEW_NAME); } catch (org.apache.uima.cas.CASRuntimeException cre) { // Let it just continue if there's an exception and check for null later } catch (org.apache.uima.cas.CASException viewException) { // Let it just continue if there's an exception and check for null later } catch (NullPointerException npe) { // Let it just continue if there's an exception and check for null later } if (viewWithPreexistingGoldAnnotations == null) { viewWithPreexistingGoldAnnotations = correspondingCasThatHasGoldAnnotations; LOGGER.debug("Using view " + viewWithPreexistingGoldAnnotations.getViewName()); int n = viewWithPreexistingGoldAnnotations.getAnnotationIndex().size(); LOGGER.debug("With " + n + " annotations"); if (n==0) { Iterator<CAS> iter = viewWithPreexistingGoldAnnotations.getCas().getViewIterator(); while (iter.hasNext()) { CAS cas = iter.next(); LOGGER.debug("view " + cas.getViewName() + " has " + cas.getAnnotationIndex().size() + " indexed annotations."); } throw new RuntimeException("n==0"); } } return viewWithPreexistingGoldAnnotations; }
private static JCas getViewWithGoldAnnotations(JCas correspondingCasThatHasGoldAnnotations) { JCas viewWithPreexistingGoldAnnotations = null; try { viewWithPreexistingGoldAnnotations = correspondingCasThatHasGoldAnnotations.getView(AssertionEvaluation.GOLD_VIEW_NAME); } catch (org.apache.uima.cas.CASRuntimeException cre) { // Let it just continue if there's an exception and check for null later } catch (org.apache.uima.cas.CASException viewException) { // Let it just continue if there's an exception and check for null later } catch (NullPointerException npe) { // Let it just continue if there's an exception and check for null later } if (viewWithPreexistingGoldAnnotations == null) { viewWithPreexistingGoldAnnotations = correspondingCasThatHasGoldAnnotations; LOGGER.debug("Using view " + viewWithPreexistingGoldAnnotations.getViewName()); int n = viewWithPreexistingGoldAnnotations.getAnnotationIndex().size(); LOGGER.debug("With " + n + " annotations"); if (n==0) { Iterator<CAS> iter = viewWithPreexistingGoldAnnotations.getCas().getViewIterator(); while (iter.hasNext()) { CAS cas = iter.next(); LOGGER.debug("view " + cas.getViewName() + " has " + cas.getAnnotationIndex().size() + " indexed annotations."); } throw new RuntimeException("n==0"); } } return viewWithPreexistingGoldAnnotations; }
viewNames.add(it.next().getViewName());
/** * Set the session data which should be used to initalize the next Cas Editor which * is opened. */ private void setEditorSessionPreferences() { // TODO: Define constants with prefix for these settings ... so they don't conflict with other plugins! IPreferenceStore sessionStore = getCasDocumentProvider(). getSessionPreferenceStore(getEditorInput()); sessionStore.setValue("LastActiveCasViewName", getDocument().getCAS().getViewName()); sessionStore.setValue("LastUsedModeType", getAnnotationMode().getName()); StringBuilder shownTypesString = new StringBuilder(); for (Type shownType : getShownAnnotationTypes()) { shownTypesString.append(shownType.getName()); shownTypesString.append(";"); } sessionStore.setValue("LastShownTypes", shownTypesString.toString()); }
final String viewName = casView.getViewName(); if (cas.getViewName().equals(viewName)) actionItem.setSelection(true);
while (viewIterator.hasNext()) { CAS each = (CAS) viewIterator.next(); String viewName = each.getViewName(); if (viewName.equals(view)) { cas = cas.getView(view);
if (reloadScript || (!initialized && !cas.getViewName().equals(CAS.NAME_DEFAULT_SOFA))) { initializeScript(cas.getViewName()); } else { resetEnvironments(cas);
String realSource = aJCas.getCas().getView(source).getViewName(); String realTarget = aJCas.getCas().getView(target).getViewName();
String sofaName=aCas.getViewName(); if (sofaName != null) { isTCas=1;