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

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

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

CAS.getViewIterator介绍

[英]Get iterator over all views in this CAS. Each view provides access to Sofa data and the index repository that contains metadata (annotations and other feature structures) pertaining to that Sofa.
[中]获取此CAS中所有视图的迭代器。每个视图都提供对Sofa数据和索引存储库的访问,其中包含与该Sofa相关的元数据(注释和其他要素结构)。

代码示例

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

@Override
public void process(CAS aCAS) throws AnalysisEngineProcessException {
 out.println("======== CAS " + iCas + " begin ==================================");
 out.println();
 Iterator<CAS> viewIt = aCAS.getViewIterator();
 while (viewIt.hasNext()) {
  CAS view = viewIt.next();
  processView(view);
  if (view.getDocumentText() == null && view.getSofaDataStream() != null) {
   processSofaData(view);
  }
 }
 out.println("======== CAS " + iCas + " end ==================================");
 out.println();
 out.println();
 out.flush();
 iCas++;
}

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

@Override
public void process(CAS aCAS)
  throws AnalysisEngineProcessException
{
  out.println("======== CAS " + iCas + " begin ==================================");
  out.println();
  Iterator<CAS> viewIt = aCAS.getViewIterator();
  while (viewIt.hasNext()) {
    CAS view = viewIt.next();
    processView(view);
    if (view.getDocumentText() == null && view.getSofaDataStream() != null) {
      processSofaData(view);
    }
  }
  out.println("======== CAS " + iCas + " end ==================================");
  out.println();
  out.println();
  out.flush();
  iCas++;
}

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

@Override
public void process(CAS aCAS)
  throws AnalysisEngineProcessException
{
  out.println("======== CAS " + iCas + " begin ==================================");
  out.println();
  Iterator<CAS> viewIt = aCAS.getViewIterator();
  while (viewIt.hasNext()) {
    CAS view = viewIt.next();
    processView(view);
    if (view.getDocumentText() == null && view.getSofaDataStream() != null) {
      processSofaData(view);
    }
  }
  out.println("======== CAS " + iCas + " end ==================================");
  out.println();
  out.println();
  out.flush();
  iCas++;
}

代码示例来源: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: apache/uima-uimaj

Iterator<CAS> viewIterator = aSrcCas.getViewIterator();
while (viewIterator.hasNext()) {
 CAS view = viewIterator.next();

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

for (Iterator<CAS> it = getDocument().getCAS().getViewIterator(); it.hasNext(); ) {
 viewNames.add(it.next().getViewName());

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

if (view != null) {
 boolean found = false;
 Iterator<CAS> viewIterator = cas.getViewIterator();
 while (viewIterator.hasNext()) {
  CAS each = (CAS) viewIterator.next();

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

for (Iterator<CAS> it = cas.getViewIterator(); it.hasNext(); ) {

相关文章