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); } } } } } }
/** Finds the nominal predicates in the parse tree. */ public void identify() { predicateHeads = new LinkedHashSet<S>(); for (S node : TreeIterator.iterableTree(tree.getTree())) { if (SimplerCanonicalPosTag.NOUN.equals( SimplerPosTagConvertor.simplerPos( InfoGetFields.getCanonicalPartOfSpeech(node.getInfo())))) { if (nomlexMap .keySet() .contains(InfoGetFields.getLemma(node.getInfo()).trim().toLowerCase())) { predicateHeads.add(node); } } } }