Examples of AnnotationTreeNode


Examples of org.apache.uima.cas.text.AnnotationTreeNode

      CAS cas = CasCreationUtils.createCas(tsDesc, null, new FsIndexDescription[0]);
      SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
      XCASDeserializer xcasDeserializer = new XCASDeserializer(cas.getTypeSystem());
      File xcasFile = new File(xcasDir, sampleXcas1FileName);
      parser.parse(xcasFile, xcasDeserializer.getXCASHandler(cas));
      AnnotationTreeNode root = cas.getAnnotationIndex().tree(cas.getDocumentAnnotation())
    .getRoot();
      // There are 7 paragraph annotations in the CAS.
      assertTrue("There should be 7 paragraphs, but are: " + root.getChildCount(), root
    .getChildCount() == 7);
      // The first paragraph contains 19 sentences, each subsequent one
      // contains only one sentence.
      assertTrue(root.getChild(0).getChildCount() == 19);
      for (int i = 1; i < root.getChildCount(); i++) {
  assertTrue(root.getChild(i).getChildCount() == 1);
      }
      // First sentence contains 8 tokens.
      assertTrue(root.getChild(0).getChild(0).getChildCount() == 8);
      // Same for only sentence in second paragraph.
      assertTrue(root.getChild(1).getChild(0).getChildCount() == 8);
    } catch (IOException e) {
      e.printStackTrace();
      assertTrue(false);
    }
  }
View Full Code Here

Examples of org.apache.uima.ruta.caseditor.view.tree.AnnotationTreeNode

  }

  @Override
  public String getText(Object element) {
    if (element instanceof AnnotationTreeNode) {
      AnnotationTreeNode fnNode = (AnnotationTreeNode) element;
      if (fnNode.getAnnotation() != null) {
        String typeName = fnNode.getAnnotation().getType().getName();
        String coveredText = fnNode.getAnnotation().getCoveredText();
        coveredText = coveredText.replaceAll("[\\n]", "").replaceAll("[\\r]", "");
        if (typeName.equals(ICasEvaluator.FALSE_POSITIVE)
                || typeName.equals(ICasEvaluator.FALSE_NEGATIVE)
                || typeName.equals(ICasEvaluator.TRUE_POSITIVE)) {
          return coveredText;
        }
        String name = TextUtils.shrinkNamespace(fnNode.getAnnotation().getType().getName());
        return (name + ": " + coveredText);
      }
    }
    if (element instanceof TypeTreeNode) {
      TypeTreeNode testNode = (TypeTreeNode) element;
View Full Code Here

Examples of org.apache.uima.ruta.caseditor.view.tree.AnnotationTreeNode

    if (parentElement instanceof TypeTreeNode) {
      TypeTreeNode node = (TypeTreeNode) parentElement;
      return node.getChildren();
    }
    if (parentElement instanceof AnnotationTreeNode) {
      AnnotationTreeNode node = (AnnotationTreeNode) parentElement;
      return node.getChildren();
    }
    return empty;
  }
View Full Code Here

Examples of org.apache.uima.ruta.caseditor.view.tree.AnnotationTreeNode

        TypeTreeNode parentTypeNode = containsTypeNode(fproot, originalfs);
        if (parentTypeNode == null && originalfs != null) {
          parentTypeNode = new TypeTreeNode(fproot, originalfs.getType());
          fproot.addChild(parentTypeNode);
        }
        AnnotationTreeNode newNode = new AnnotationTreeNode(parentTypeNode, a);
        if (parentTypeNode != null) {
          parentTypeNode.addChild(newNode);
        } else {
          RutaAddonsPlugin.error(new IllegalArgumentException(
                  "Trying to display unknown type for " + a));
View Full Code Here

Examples of org.apache.uima.ruta.caseditor.view.tree.AnnotationTreeNode

  }

  @Override
  public String getText(Object element) {
    if (element instanceof AnnotationTreeNode) {
      AnnotationTreeNode fnNode = (AnnotationTreeNode) element;
      if (fnNode.getAnnotation() != null) {
        String typeName = fnNode.getAnnotation().getType().getName();
        String coveredText = fnNode.getAnnotation().getCoveredText();
        coveredText = coveredText.replaceAll("[\\n]", "").replaceAll("[\\r]", "");
        if (typeName.equals(ICasEvaluator.FALSE_POSITIVE)
                || typeName.equals(ICasEvaluator.FALSE_NEGATIVE)
                || typeName.equals(ICasEvaluator.TRUE_POSITIVE)) {
          return coveredText;
        }
        String name = TextUtils.shrinkNamespace(fnNode.getAnnotation().getType().getName());
        return (name + ": " + coveredText);
      }
    }
    if (element instanceof TypeTreeNode) {
      TypeTreeNode testNode = (TypeTreeNode) element;
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.