private void findSpecs() throws TeEngineMlException, RuleBaseException {
   this.specs = new LinkedHashSet<RuleSubstituteNodeSpecification<T>>();
   for (ExtendedNode node : TreeIterator.iterableTree(treeAndParentMap.getTree())) {
     if (isRelevantNode(node)) {
       if (InfoObservations.infoHasLemma(node.getInfo())) {
         LemmaAndPos lemmaAndPos =
             new LemmaAndPos(
                 InfoGetFields.getLemma(node.getInfo()),
                 InfoGetFields.getPartOfSpeechObject(node.getInfo()));
         ImmutableSet<T> rules = getRulesForLemmaAndPos(lemmaAndPos);
         for (T rule : rules) {
           if (isRelevantRule(rule)) {
             NodeInfo newNodeInfo =
                 new DefaultNodeInfo(
                     rule.getRhsLemma(),
                     rule.getRhsLemma(),
                     node.getInfo().getNodeInfo().getSerial(),
                     node.getInfo().getNodeInfo().getNamedEntityAnnotation(),
                     new DefaultSyntacticInfo(rule.getRhsPos()));
             RuleSubstituteNodeSpecification<T> spec =
                 createSpec(node, newNodeInfo, ruleBaseName, rule);
             // new RuleSubstituteNodeSpecification<T>(node, newNodeInfo,
             // node.getInfo().getAdditionalNodeInformation(), rule.getConfidence(), ruleBaseName,
             // rule);
             addAdditionalDescription(spec, rule);
             specs.add(spec);
           }
         }
       }
     }
   }
 }
 protected RuleSubstituteNodeSpecification<T> createSpec(
     ExtendedNode node,
     NodeInfo newNodeInfo,
     String ruleBaseName,
     T rule,
     boolean writeConfidenceInDescription) {
   return new RuleSubstituteNodeSpecification<T>(
       node,
       newNodeInfo,
       node.getInfo().getAdditionalNodeInformation(),
       rule.getConfidence(),
       ruleBaseName,
       rule,
       writeConfidenceInDescription);
 }
 public boolean nodesMatch(ExtendedNode mainNode, ExtendedNode testNode) {
   if ((mainNode == null) && (testNode == null)) return true;
   else if ((mainNode == null) || (testNode == null)) return false;
   else return this.nodesInfoMatch(mainNode.getInfo(), testNode.getInfo());
 }