org.apache.uima.cas.CAS.getViewName()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(9.7k)|赞(0)|评价(0)|浏览(193)

本文整理了Java中org.apache.uima.cas.CAS.getViewName()方法的一些代码示例,展示了CAS.getViewName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CAS.getViewName()方法的具体详情如下:
包路径:org.apache.uima.cas.CAS
类名称:CAS
方法名:getViewName

CAS.getViewName介绍

[英]Get the view name. The view name is the same as the name of the view's Sofa, retrieved by getSofa().getSofaID(), except for the initial View before its Sofa has been created.
[中]获取视图名称。视图名称与视图的沙发名称相同,由getSofa()检索。getSofaID(),创建沙发之前的初始视图除外。

代码示例

代码示例来源:origin: nlpie/biomedicus

CASDocument(CAS view, @Nullable LabelAdapters labelAdapters) {
 super(view.getViewName(), view.getDocumentText());
 this.view = view;
 this.labelAdapters = labelAdapters;
}

代码示例来源:origin: dkpro/dkpro-core

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();
}

代码示例来源:origin: de.tudarmstadt.ukp.dkpro.core/de.tudarmstadt.ukp.dkpro.core.testing-asl

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();
}

代码示例来源:origin: org.apache.uima/uimafit-core

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();
}

代码示例来源:origin: org.apache.uima/uimaj-ep-cas-editor

@Override
public void switchView(String viewName) {
 String oldViewName = mCAS.getViewName();
 mCAS = mCAS.getView(viewName);
 fireViewChanged(oldViewName, viewName);
}

代码示例来源:origin: apache/uima-uimaj

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));    
}

代码示例来源:origin: org.apache.uima/uimaj-ep-cas-editor

@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);
  }
 }
});

代码示例来源:origin: apache/uima-uimaj

/**
 * 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);
}

代码示例来源:origin: org.apache.uima/ruta-core

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();
}

代码示例来源:origin: oaqa/baseqa

public static String annotationOffset(Annotation annotation) {
 return annotation.getView().getViewName() + ":" + annotation.getBegin() + ":" +
     annotation.getEnd();
}

代码示例来源:origin: apache/ctakes

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() + "]");

代码示例来源:origin: apache/ctakes

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;
}

代码示例来源:origin: org.apache.ctakes/ctakes-assertion

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;
}

代码示例来源:origin: org.apache.uima/uimaj-ep-cas-editor

viewNames.add(it.next().getViewName());

代码示例来源:origin: org.apache.uima/uimaj-ep-cas-editor

/**
 * 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());
}

代码示例来源:origin: org.apache.uima/uimaj-ep-cas-editor

final String viewName = casView.getViewName();
if (cas.getViewName().equals(viewName))
  actionItem.setSelection(true);

代码示例来源:origin: org.apache.uima/ruta-ep-ide-ui

while (viewIterator.hasNext()) {
 CAS each = (CAS) viewIterator.next();
 String viewName = each.getViewName();
 if (viewName.equals(view)) {
  cas = cas.getView(view);

代码示例来源:origin: org.apache.uima/ruta-core

if (reloadScript || (!initialized && !cas.getViewName().equals(CAS.NAME_DEFAULT_SOFA))) {
 initializeScript(cas.getViewName());
} else {
 resetEnvironments(cas);

代码示例来源:origin: de.tudarmstadt.ukp.dkpro.core/de.tudarmstadt.ukp.dkpro.core.castransformation-asl

String realSource = aJCas.getCas().getView(source).getViewName();
String realTarget = aJCas.getCas().getView(target).getViewName();

代码示例来源:origin: apache/uima-uimaj

String sofaName=aCas.getViewName();
if (sofaName != null) {
 isTCas=1;

相关文章