Package org.apache.uima.jcas.cas

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


      Token tok1 = new Token(jcas);
      Token tok2 = new Token(jcas);

      NonEmptyFSList fsList1 = new NonEmptyFSList(jcas);
      fsList1.setHead(tok2);
      fsList1.setTail(new EmptyFSList(jcas));
      NonEmptyFSList fsList = new NonEmptyFSList(jcas);
      fsList.setHead(tok1);
      fsList.setTail(fsList1);
      EmptyFSList emptyFsList = new EmptyFSList(jcas);

      try {
        emptyFsList.getNthElement(0);
        assertTrue(false); // error if we get here
      } catch (CASRuntimeException e) {
        assertTrue(e.getMessageKey().equals(CASRuntimeException.JCAS_GET_NTH_ON_EMPTY_LIST));
        System.out.print("Expected Error: ");
        System.out.println(e.getMessage());
View Full Code Here


      Token tok1 = new Token(jcas);
      Token tok2 = new Token(jcas);

      NonEmptyFSList fsList1 = new NonEmptyFSList(jcas);
      fsList1.setHead(tok2);
      fsList1.setTail(new EmptyFSList(jcas));
      NonEmptyFSList fsList = new NonEmptyFSList(jcas);
      fsList.setHead(tok1);
      fsList.setTail(fsList1);
      EmptyFSList emptyFsList = new EmptyFSList(jcas);

      try {
        emptyFsList.getNthElement(0);
        assertTrue(false); // error if we get here
      } catch (CASRuntimeException e) {
        assertTrue(e.getMessageKey().equals(CASRuntimeException.JCAS_GET_NTH_ON_EMPTY_LIST));
        System.out.print("Expected Error: ");
        System.out.println(e.getMessage());
View Full Code Here

    return asList(data.toArray(new Float[data.size()]));
  }

  public static FSList createFSList(JCas aJCas, Collection<? extends TOP> aCollection) {
    if (aCollection.isEmpty()) {
      return new EmptyFSList(aJCas);
    }

    NonEmptyFSList head = new NonEmptyFSList(aJCas);
    NonEmptyFSList list = head;
    Iterator<? extends TOP> i = aCollection.iterator();
    while (i.hasNext()) {
      head.setHead(i.next());
      if (i.hasNext()) {
        head.setTail(new NonEmptyFSList(aJCas));
        head = (NonEmptyFSList) head.getTail();
      } else {
        head.setTail(new EmptyFSList(aJCas));
      }
    }

    return list;
  }
View Full Code Here

        int headId = i;
        if (!headIdToPredicate.containsKey(headId)) {
          // We have not encountered this predicate yet, so create it
          Predicate pred = this.createPredicate(jCas, parserNode.srlInfo.rolesetId, token);
          headIdToPredicate.put(headId, pred);
          pred.setRelations(new EmptyFSList(jCas));
        }
      } else {
        for (SRLHead head : parserNode.srlInfo.heads) {
          Predicate predicate;
View Full Code Here

    }

    // Extract equivalence classes and save them into CAS
    int[] ec = new int[ppt.getSize()]; // class number for each Markable
    int n = ppt.equivCls(ec); // n holds the number of classes
    EmptyFSList elist = new EmptyFSList(jcas); // shared tail for all chains
    FSList[] listhds = new FSList[n]; // keep track of the heads of all chains
    CollectionTextRelation[] chains = new CollectionTextRelation[n];

    // Initialize n chains
    for (int i = 0; i < n; ++i) {
View Full Code Here

      Token tok1 = new Token(jcas);
      Token tok2 = new Token(jcas);

      NonEmptyFSList fsList1 = new NonEmptyFSList(jcas);
      fsList1.setHead(tok2);
      fsList1.setTail(new EmptyFSList(jcas));
      NonEmptyFSList fsList = new NonEmptyFSList(jcas);
      fsList.setHead(tok1);
      fsList.setTail(fsList1);
      EmptyFSList emptyFsList = new EmptyFSList(jcas);

      try {
        emptyFsList.getNthElement(0);
        assertTrue(false); // error if we get here
      } catch (CASRuntimeException e) {
        assertTrue(e.getMessageKey().equals(CASRuntimeException.JCAS_GET_NTH_ON_EMPTY_LIST));
        System.out.print("Expected Error: ");
        System.out.println(e.getMessage());
View Full Code Here

      head.setHead(i.next());
      if (i.hasNext()) {
        head.setTail(new NonEmptyFSList(jCas));
        head = (NonEmptyFSList) head.getTail();
      } else {
        head.setTail(new EmptyFSList(jCas));
      }
    }

    // Print what is expected
    for (FeatureStructure fs : allFS) {
View Full Code Here

      Token tok1 = new Token(jcas);
      Token tok2 = new Token(jcas);

      NonEmptyFSList fsList1 = new NonEmptyFSList(jcas);
      fsList1.setHead(tok2);
      fsList1.setTail(new EmptyFSList(jcas));
      NonEmptyFSList fsList = new NonEmptyFSList(jcas);
      fsList.setHead(tok1);
      fsList.setTail(fsList1);
      EmptyFSList emptyFsList = new EmptyFSList(jcas);

      try {
        emptyFsList.getNthElement(0);
        assertTrue(false); // error if we get here
      } catch (CASRuntimeException e) {
        assertTrue(e.getMessageKey().equals(CASRuntimeException.JCAS_GET_NTH_ON_EMPTY_LIST));
        System.out.print("Expected Error: ");
        System.out.println(e.getMessage());
View Full Code Here

        {
          if (!headIdToPredicate.containsKey(parserNode)) {
            // We have not encountered this predicate yet, so create it
            Predicate pred = this.createPredicate(jCas, rolesetId, token);
            headIdToPredicate.put(parserNode, pred);
            pred.setRelations(new EmptyFSList(jCas));
          }
        }
    }
   
   
View Full Code Here

    String docName = DocumentIDAnnotationUtil.getDocumentID(jcas);
    logger.info("Classifying coreference in document: " + docName);
//    ArrayList<CollectionTextRelation> chains = new ArrayList<CollectionTextRelation>();
    int chainId = 0;
   
    EmptyFSList emptyList = new EmptyFSList(jcas);
    // Create a parent pointer tree to calculate equivalence classes
//    ppt = new ParentPtrTree(lm.size());

    // Make a data structure mapping markables to indexes so we don't lose the order if we re-arrange
    Map<Markable, Integer> m2q = new HashMap<Markable,Integer>();
View Full Code Here

TOP

Related Classes of org.apache.uima.jcas.cas.EmptyFSList

Copyright © 2018 www.massapicom. 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.