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

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

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

CAS.getTypeSystem介绍

[英]Return the type system of this CAS instance.
[中]返回此CAS实例的类型系统。

代码示例

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

private Type getType(String name, CAS cas) {
 String typeName = HtmlAnnotator.NAMESPACE + name;
 Type type = cas.getTypeSystem().getType(typeName);
 if (type == null) {
  type = cas.getTypeSystem().getType(HtmlAnnotator.NAMESPACE + "TAG");
 }
 return type;
}

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

private Type getType(String name, CAS cas) {
 String typeName = HtmlAnnotator.NAMESPACE + name;
 Type type = cas.getTypeSystem().getType(typeName);
 if (type == null) {
  type = cas.getTypeSystem().getType(HtmlAnnotator.NAMESPACE + "TAG");
 }
 return type;
}

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

/**
 * Helper to get the test type, e.g. org.apache.uima.T1, org.apache.uima.T2, ...
 * 
 * @param cas - The CAS object containing the type system
 * @param i - typeId, converted to {@link #TYPE} + i
 * @return the test type object with the given counter
 */
public static Type getTestType(CAS cas, int i) {
 if (cas == null)
  return null;
 return cas.getTypeSystem().getType(TYPE + i);
}

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

/**
 * Checks it the type system of the given CAS is different from the last type system this
 * component was operating on. If it is different, calls the typeSystemInit method on the
 * component.
 */
private void checkTypeSystemChange(CAS aCAS) throws AnalysisEngineProcessException {
 TypeSystem typeSystem = aCAS.getTypeSystem();
 if (typeSystem != mLastTypeSystem) {
  typeSystemInit(typeSystem);
  mLastTypeSystem = typeSystem;
 }
}

代码示例来源:origin: webanno/webanno

private boolean chainAnnotationExists(CAS aCas, String aType) {

    Type type = aCas.getTypeSystem().getType(aType);
    if (CasUtil.selectFS(aCas, type).size() == 0) {
      return false;
    }
    return true;
  }
}

代码示例来源:origin: de.tudarmstadt.ukp.clarin.webanno/webanno-io-tsv

private boolean chainAnnotationExists(CAS aCas, String aType) {

    Type type = aCas.getTypeSystem().getType(aType);
    if (CasUtil.selectFS(aCas, type).size() == 0) {
      return false;
    }
    return true;
  }
}

代码示例来源:origin: fr.univ-nantes.julestar/uima-tokens-regex

public Feature getFeature(AnnotationFS annotation) {
  if(f==null) {
    /*
     * TODO Ensure that the Feature will be reset for a new TypeSystem
     */
    f = annotation.getCAS().getTypeSystem().getFeatureByFullName(feature);
  }
  return f;
}

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

/**
 * Gets the types.
 *
 * @return the types
 */
private Type[] getTypes() {
 TypeSystem typeSystem = editor.getDocument().getCAS().getTypeSystem();
 List<Type> types =
     typeSystem.getProperlySubsumedTypes(typeSystem.getType(CAS.TYPE_NAME_ANNOTATION));
 types.add(typeSystem.getType(CAS.TYPE_NAME_ANNOTATION));
 
 return types.toArray(new Type[types.size()]);
}

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

public static Set<FeatureStructure> getNonIndexedFSes(CAS aCas)
{
  TypeSystem ts = aCas.getTypeSystem();
  Set<FeatureStructure> allIndexedFS = collectIndexed(aCas);
  Set<FeatureStructure> allReachableFS = collectReachable(aCas);
  // Remove all that are indexed
  allReachableFS.removeAll(allIndexedFS);
  // Remove all that are not annotations
  allReachableFS.removeIf(fs -> !ts.subsumes(aCas.getAnnotationType(), fs.getType()));
  // All that is left are non-index annotations
  return allReachableFS;
}

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

public static Set<FeatureStructure> collectIndexed(CAS aCas)
{
  LowLevelCAS llcas = aCas.getLowLevelCAS();
  Set<FeatureStructure> fses = new TreeSet<>((fs1, fs2) -> llcas.ll_getFSRef(fs1)
      - llcas.ll_getFSRef(fs2));
  FSIterator<FeatureStructure> i = aCas.getIndexRepository().getAllIndexedFS(
      aCas.getTypeSystem().getTopType());
  i.forEachRemaining(fs -> fses.add(fs));
  return fses;
}

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

public static Set<FeatureStructure> collectIndexed(CAS aCas)
{
  LowLevelCAS llcas = aCas.getLowLevelCAS();
  Set<FeatureStructure> fses = new TreeSet<>((fs1, fs2) -> llcas.ll_getFSRef(fs1)
      - llcas.ll_getFSRef(fs2));
  FSIterator<FeatureStructure> i = aCas.getIndexRepository().getAllIndexedFS(
      aCas.getTypeSystem().getTopType());
  i.forEachRemaining(fs -> fses.add(fs));
  return fses;
}

代码示例来源:origin: de.tudarmstadt.ukp.dkpro.lab/de.tudarmstadt.ukp.dkpro.lab.uima

@Override
public void write(OutputStream aStream)
  throws Exception
{
  XmiCasSerializer ser = new XmiCasSerializer(cas.getTypeSystem());
  XMLSerializer xmlSer = new XMLSerializer(aStream, false);
  ser.serialize(cas, xmlSer.getContentHandler());
}

代码示例来源:origin: org.dkpro.lab/dkpro-lab-uima

@Override
public void write(OutputStream aStream)
  throws Exception
{
  XmiCasSerializer ser = new XmiCasSerializer(cas.getTypeSystem());
  XMLSerializer xmlSer = new XMLSerializer(aStream, false);
  ser.serialize(cas, xmlSer.getContentHandler());
}

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

private void removePartOf(int code) {
 if (partOf[code] != 0) {
  partOf[code] = partOf[code] - 1;
  if (!lowMemoryProfile) {
   int parentCode = getCAS().getTypeSystem().getLowLevelTypeSystem().ll_getParentType(code);
   if (parentCode > 0) {
    removePartOf(parentCode);
   }
  }
 }
}

代码示例来源:origin: CLLKazan/UIMA-Ext

private void writeXmi(CAS aCas, OutputStream out) throws IOException,
      SAXException {
    // seems like it is not necessary to buffer outputStream for SAX TransformationHandler
    // out = new BufferedOutputStream(out);
    XmiCasSerializer ser = new XmiCasSerializer(aCas.getTypeSystem());
    XMLSerializer xmlSer = new XMLSerializer(out, xmlFormatted);
    ser.serialize(aCas, xmlSer.getContentHandler());
  }
}

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

private void insertFS(FeatureStructure fs, Type type, CAS cas, boolean withParents) {
 TypeTreeNode typeTreeNode = getTreeNode(type, cas);
 FSTreeNode node = createFSNode(typeTreeNode, fs);
 typeTreeNode.addChild(node);
 if (withParents) {
  Type parent = fs.getCAS().getTypeSystem().getParent(type);
  if (parent != null) {
   insertFS(fs, parent, cas, withParents);
  }
 }
}

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

public static FeatureStructure getTcasFS(CAS aCasView, String aTypeS) {
 org.apache.uima.cas.FeatureStructure idFS = null;
 Type type = aCasView.getTypeSystem().getType(aTypeS);
 if (type != null) {
  FSIterator<AnnotationFS> idIter = aCasView.getAnnotationIndex(type).iterator();
  while (idIter.isValid()) {
   idFS = idIter.get();
   idIter.moveToNext();
  }
 }
 return idFS;
}

代码示例来源:origin: de.tudarmstadt.ukp.dkpro.tc/dkpro-tc-ml

private void addTCSequenceAnnotation(JCas jcas)
{
  Type type = jcas.getCas().getTypeSystem().getType(nameSequence);
  Collection<AnnotationFS> sequenceAnnotation = CasUtil.select(jcas.getCas(), type);
  for (AnnotationFS seq : sequenceAnnotation) {
    TextClassificationSequence tcs = new TextClassificationSequence(jcas, seq.getBegin(),
        seq.getEnd());
    tcs.addToIndexes();
  }
}

代码示例来源:origin: org.dkpro.tc/dkpro-tc-ml

private void addTCSequenceAnnotation(JCas jcas)
{
  Type type = jcas.getCas().getTypeSystem().getType(nameSequence);
  Collection<AnnotationFS> sequenceAnnotation = CasUtil.select(jcas.getCas(), type);
  for (AnnotationFS seq : sequenceAnnotation) {
    TextClassificationSequence tcs = new TextClassificationSequence(jcas, seq.getBegin(),
        seq.getEnd());
    tcs.addToIndexes();
  }
}

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

private void addTCSequenceAnnotation(JCas jcas) {
  Type type = jcas.getCas().getTypeSystem().getType(sequenceName);
  Collection<AnnotationFS> sequenceAnnotation = CasUtil.select(jcas.getCas(), type);
  for (AnnotationFS seq : sequenceAnnotation) {
    TextClassificationSequence tcs = new TextClassificationSequence(jcas, seq.getBegin(), seq.getEnd());
    tcs.addToIndexes();
  }
}

相关文章