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

x33g5p2x  于2022-01-16 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(72)

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

ArrayFS.copyFromArray介绍

[英]Copy the contents of an external array into this array.
[中]将外部数组的内容复制到此数组中。

代码示例

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

protected AnnotationFS createAnnotation(CAS cas, int offset, Parse parse) {
 Parse[] parseChildren = parse.getChildren();
 AnnotationFS[] parseChildAnnotations = new AnnotationFS[parseChildren.length];
 // do this for all children
 for (int i = 0; i < parseChildren.length; i++) {
  parseChildAnnotations[i] = createAnnotation(cas, offset, parseChildren[i]);
 }
 AnnotationFS parseAnnotation = cas.createAnnotation(mParseType, offset +
   parse.getSpan().getStart(), offset + parse.getSpan().getEnd());
 parseAnnotation.setStringValue(mTypeFeature, parse.getType());
 if (probabilityFeature != null) {
  parseAnnotation.setDoubleValue(probabilityFeature, parse.getProb());
 }
 ArrayFS childrenArray = cas.createArrayFS(parseChildAnnotations.length);
 childrenArray.copyFromArray(parseChildAnnotations, 0, 0, parseChildAnnotations.length);
 parseAnnotation.setFeatureValue(childrenFeature, childrenArray);
 cas.getIndexRepository().addFS(parseAnnotation);
 return parseAnnotation;
}

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

public static ArrayFS fillArrayFS(ArrayFS aArrayFs, FeatureStructure[] aArray) {
 aArrayFs.copyFromArray(aArray, 0, 0, aArrayFs.size());
 return aArrayFs;
}

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

/**
 * update a base annotation with slot annotations
 * 
 * @param linkFSesPerAnno
 *            contains list of slot annotations per a base annotation
 * @param aLinkeF
 *            The link slot annotation feature
 */
private void addSlotAnnotations(Map<AnnotationFS, List<FeatureStructure>> linkFSesPerAnno,
    Feature aLinkeF)
{
  for (AnnotationFS anno : linkFSesPerAnno.keySet()) {
    ArrayFS array = anno.getCAS().createArrayFS(linkFSesPerAnno.get(anno).size());
    array.copyFromArray(
        linkFSesPerAnno.get(anno)
            .toArray(new FeatureStructure[linkFSesPerAnno.get(anno).size()]),
        0, 0, linkFSesPerAnno.get(anno).size());
    anno.setFeatureValue(aLinkeF, array);
    anno.getCAS().addFsToIndexes(anno);
  }
}

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

/**
 * update a base annotation with slot annotations
 * 
 * @param linkFSesPerAnno
 *            contains list of slot annotations per a base annotation
 * @param aLinkeF
 *            The link slot annotation feature
 */
private void addSlotAnnotations(Map<AnnotationFS, List<FeatureStructure>> linkFSesPerAnno, Feature aLinkeF) {
  for (AnnotationFS anno : linkFSesPerAnno.keySet()) {
    ArrayFS array = anno.getCAS().createArrayFS(linkFSesPerAnno.get(anno).size());
    array.copyFromArray(
        linkFSesPerAnno.get(anno).toArray(new FeatureStructure[linkFSesPerAnno.get(anno).size()]), 0, 0,
        linkFSesPerAnno.get(anno).size());
    anno.setFeatureValue(aLinkeF, array);
    anno.getCAS().addFsToIndexes(anno);
  }
}

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

/**
 * update a base annotation with slot annotations
 * 
 * @param linkFSesPerAnno
 *            contains list of slot annotations per a base annotation
 * @param aLinkeF
 *            The link slot annotation feature
 */
private void addSlotAnnotations(Map<AnnotationFS, List<FeatureStructure>> linkFSesPerAnno,
    Feature aLinkeF)
{
  for (AnnotationFS anno : linkFSesPerAnno.keySet()) {
    ArrayFS array = anno.getCAS().createArrayFS(linkFSesPerAnno.get(anno).size());
    array.copyFromArray(
        linkFSesPerAnno.get(anno)
            .toArray(new FeatureStructure[linkFSesPerAnno.get(anno).size()]),
        0, 0, linkFSesPerAnno.get(anno).size());
    anno.setFeatureValue(aLinkeF, array);
    anno.getCAS().addFsToIndexes(anno);
  }
}

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

public static void setLinkFeatureValue(FeatureStructure aFS, Feature aFeature,
    List<FeatureStructure> linkFSes)
{
  // Create a new array if size differs otherwise re-use existing one
  ArrayFS array = (ArrayFS) WebAnnoCasUtil.getFeatureFS(aFS, aFeature.getShortName());
  if (array == null || (array.size() != linkFSes.size())) {
    array = aFS.getCAS().createArrayFS(linkFSes.size());
  }
  // Fill in links
  array.copyFromArray(linkFSes.toArray(new FeatureStructure[linkFSes.size()]), 0, 0,
      linkFSes.size());
  aFS.setFeatureValue(aFeature, array);
}

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

public static void setLinkFeatureValue(FeatureStructure aFS, Feature aFeature,
    List<FeatureStructure> linkFSes)
{
  // Create a new array if size differs otherwise re-use existing one
  ArrayFS array = (ArrayFS) WebAnnoCasUtil.getFeatureFS(aFS, aFeature.getShortName());
  if (array == null || (array.size() != linkFSes.size())) {
    array = aFS.getCAS().createArrayFS(linkFSes.size());
  }
  // Fill in links
  array.copyFromArray(linkFSes.toArray(new FeatureStructure[linkFSes.size()]), 0, 0,
      linkFSes.size());
  aFS.setFeatureValue(aFeature, array);
}

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

array.copyFromArray(linkFSes.toArray(new FeatureStructure[linkFSes.size()]), 0,
    0, linkFSes.size());
baseFs.setFeatureValue(roleFeature, array);

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

array.copyFromArray(linkFSes.toArray(new FeatureStructure[linkFSes.size()]), 0,
    0, linkFSes.size());
baseFs.setFeatureValue(roleFeature, array);

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

protected AnnotationFS createAnnotation(CAS cas, int offset, Parse parse) {
 Parse[] parseChildren = parse.getChildren();
 AnnotationFS[] parseChildAnnotations = new AnnotationFS[parseChildren.length];
 // do this for all children
 for (int i = 0; i < parseChildren.length; i++) {
  parseChildAnnotations[i] = createAnnotation(cas, offset, parseChildren[i]);
 }
 AnnotationFS parseAnnotation = cas.createAnnotation(mParseType, offset +
   parse.getSpan().getStart(), offset + parse.getSpan().getEnd());
 parseAnnotation.setStringValue(mTypeFeature, parse.getType());
 if (probabilityFeature != null) {
  parseAnnotation.setDoubleValue(probabilityFeature, parse.getProb());
 }
 ArrayFS childrenArray = cas.createArrayFS(parseChildAnnotations.length);
 childrenArray.copyFromArray(parseChildAnnotations, 0, 0, parseChildAnnotations.length);
 parseAnnotation.setFeatureValue(childrenFeature, childrenArray);
 cas.getIndexRepository().addFS(parseAnnotation);
 return parseAnnotation;
}

相关文章

微信公众号

最新文章

更多