Examples of FSList


Examples of org.apache.uima.jcas.cas.FSList

  // Using TOP here because FSList is only available in the JCas.
  public static Collection<TOP> create(FSList aList, Type type) {
    TypeSystem ts = aList.getCAS().getTypeSystem();
    List<FeatureStructure> data = new ArrayList<FeatureStructure>();
    FSList i = aList;
    while (i instanceof NonEmptyFSList) {
      NonEmptyFSList l = (NonEmptyFSList) i;
      TOP value = l.getHead();
      if (value != null && (type == null || ts.subsumes(type, value.getType()))) {
        data.add(l.getHead());
View Full Code Here

Examples of org.apache.uima.jcas.cas.FSList

        relation.addToIndexes();
        relations.add(relation);
        argument.setRelation(relation);
      }
     
      FSList relationsList = ListFactory.buildList(jCas, relations.toArray(new TOP[relations.size()]));
      predicate.setRelations(relationsList);
    }
  }
View Full Code Here

Examples of org.apache.uima.jcas.cas.FSList

      MarkablePairSet pair = (MarkablePairSet) iter.next();
      Markable anaphor = pair.getAnaphor();
      String corefType = (anaphor instanceof NEMarkable ? CorefConsts.NE : (anaphor instanceof DemMarkable ? CorefConsts.DEM : CorefConsts.PRON));
      //      String nodeStr = vec.getVector();
      //      int label = getLabel(nodeStr);
      FSList pairList = pair.getAntecedentList();
      while(pairList instanceof NonEmptyFSList){
        NonEmptyFSList node = (NonEmptyFSList) pairList;
        BooleanLabeledFS labeledProb = (BooleanLabeledFS) node.getHead();
        int label = labeledProb.getLabel() ? 1 : 0;
        if(anaphora){
View Full Code Here

Examples of org.apache.uima.jcas.cas.FSList

   
    FSIterator<Annotation> iter = jcas.getAnnotationIndex(MarkablePairSet.type).iterator();
    while(iter.hasNext()){
      MarkablePairSet set = (MarkablePairSet) iter.next();
      Markable anaphor = set.getAnaphor();
      FSList fs = (FSList) set.getAntecedentList();
      MarkableProb bestAnte = null;
      LinkedList<Markable> ll = fs2ll(fs);
      if(anaphor instanceof PronounMarkable){
        bestAnte = processPronoun(anaphor, ll, jcas);
      }else if(anaphor instanceof NEMarkable){
View Full Code Here

Examples of org.apache.uima.jcas.cas.FSList

      Type type = cas.getTypeSystem().getType("org.apache.clerezza.uima.utils.ts.WikipediaEntity");
      FSIterator<FeatureStructure> entities = cas.getJCas().getIndexRepository()
              .getAllIndexedFS(type);
      assertTrue(entities.hasNext());
      while (entities.hasNext()) {
        FSList references = (FSList) entities.next().getFeatureValue(
                type.getFeatureByBaseName("references"));
        assertNotNull(references.getNthElement(0));
      }
    } catch (Exception e) {
      fail(e.getLocalizedMessage());
    }
  }
View Full Code Here

Examples of org.apache.uima.jcas.cas.FSList

  @Override
  public void process(JCas jcas) throws AnalysisEngineProcessException {
    WikipediaEntity wikipediaEntity = new WikipediaEntity(jcas);
    wikipediaEntity.setUri("http://en.wikipedia.org/wiki/STS-135");
    wikipediaEntity.setLabel("STS-135");
    FSList stsAnnotationsList = findSTSAnnotations(jcas);
    wikipediaEntity.setReferences(stsAnnotationsList);
    wikipediaEntity.addToIndexes();

  }
View Full Code Here

Examples of org.apache.uima.jcas.cas.FSList

      List<Predicate> preds = JCasUtil.selectCovered(Predicate.class, arg1);
      if(preds.size() > 0){
        feats.add(new Feature("Arg1_Pred", true));
        feats.add(new Feature("Arg1_Frame", preds.get(0).getFrameSet()));
        // check if arg2 is one of its SRL args
        FSList relList = preds.get(0).getRelations();
        while(relList instanceof NonEmptyFSList){
          SemanticRoleRelation rel = (SemanticRoleRelation) ((NonEmptyFSList)relList).getHead();
          SemanticArgument arg = rel.getArgument();
          if(arg.getBegin() == arg2.getBegin() && arg.getEnd() == arg2.getEnd()){
            feats.add(new Feature("Arg1_Pred_Arg2_Role", true));
            break;
          }
          relList = ((NonEmptyFSList)relList).getTail();
        }
      }
      List<SemanticArgument> args = JCasUtil.selectCovered(SemanticArgument.class, arg1);
      if(args.size() > 0){
        feats.add(new Feature("Arg1_SemArg", true));
        feats.add(new Feature("Arg1_SemArgType", args.get(0).getLabel()));
      }
    }
   
    if(arg2 instanceof EventMention){
      List<Predicate> preds = JCasUtil.selectCovered(Predicate.class, arg2);
      if(preds.size() > 0){
        feats.add(new Feature("Arg2_Pred", true));
        feats.add(new Feature("Arg2_Frame", preds.get(0).getFrameSet()));
        // check if arg2 is one of its SRL args
        FSList relList = preds.get(0).getRelations();
        while(relList instanceof NonEmptyFSList){
          SemanticRoleRelation rel = (SemanticRoleRelation) ((NonEmptyFSList)relList).getHead();
          SemanticArgument arg = rel.getArgument();
          if(arg.getBegin() == arg1.getBegin() && arg.getEnd() == arg1.getEnd()){
            feats.add(new Feature("Arg2_Pred_Arg1_Role", true));
View Full Code Here

Examples of org.apache.uima.jcas.cas.FSList

        pred = entRel.getPredicate();
        String feat = "pred:" + pred.getCoveredText().replace(' ', '_').toLowerCase();
        feats.add(feat);

        // get the relation this arg belongs to, then its predicate, then the other arguments (via relations)
        FSList rels = entArg.getRelation().getPredicate().getRelations();
        while(rels instanceof NonEmptyFSList){
          NonEmptyFSList node = (NonEmptyFSList) rels;
          SemanticRoleRelation curRel = (SemanticRoleRelation) node.getHead();
          SemanticArgument curArg =  curRel.getArgument();
          if(entArg.getCoveredText().equals(curArg.getCoveredText())){
View Full Code Here

Examples of org.apache.uima.jcas.cas.FSList

        relation.addToIndexes();
        relations.add(relation);
        argument.setRelation(relation);
      }
     
      FSList relationsList = ListFactory.buildList(jCas, relations.toArray(new TOP[relations.size()]));
      predicate.setRelations(relationsList);
    }
  }
View Full Code Here

Examples of org.apache.uima.jcas.cas.FSList

        lemma.setPosTag(pos);
        lemmas.add(lemma);
      }
    }
    Lemma[] lemmaArray = lemmas.toArray(new Lemma[lemmas.size()]);
    FSList fsList = ListFactory.buildList(jcas, lemmaArray);
    wordAnnotation.setLemmaEntries(fsList);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.