Package org.apache.uima.ruta.explain.tree

Examples of org.apache.uima.ruta.explain.tree.IExplainTreeNode


  }

  @Override
  public String getText(Object element) {
    if (element instanceof IExplainTreeNode) {
      IExplainTreeNode debugNode = (IExplainTreeNode) element;
      TypeSystem ts = debugNode.getTypeSystem();

      if (element instanceof RuleElementMatchesNode) {
        Type type = ts.getType(ExplainConstants.RULE_ELEMENT_MATCHES_TYPE);
        FeatureStructure fs = debugNode.getFeatureStructure();
        Feature f = type.getFeatureByBaseName(ExplainConstants.ELEMENT);
        Feature fanchor = type.getFeatureByBaseName(ExplainConstants.RULE_ANCHOR);
        if (f != null && fanchor != null) {
          String v = fs.getStringValue(f);
          String ruleAnchor = fs.getBooleanValue(fanchor) ? "'" : "";
          return ruleAnchor + v;
        }
      } else if (element instanceof RuleElementMatchNode) {
        FeatureStructure fs = debugNode.getFeatureStructure();
        if (fs instanceof AnnotationFS) {
          String s = ((AnnotationFS) fs).getCoveredText();
          s = s.replaceAll("[\\n\\r]", "");

          return s;
        }
      } else if (element instanceof ConditionNode) {
        Type type = ts.getType(ExplainConstants.EVAL_CONDITION_TYPE);
        FeatureStructure fs = debugNode.getFeatureStructure();
        Feature f = type.getFeatureByBaseName(ExplainConstants.ELEMENT);
        if (f != null) {
          String v = fs.getStringValue(f);
          return v;
        }
View Full Code Here

TOP

Related Classes of org.apache.uima.ruta.explain.tree.IExplainTreeNode

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.