@Override public String toString() { return origStr + "\t" + namedEntity + "\t" + (lemmas != null && lemmas.size() == 1? lemmas.get(0): lemmas) + "\t" + posTag; } }
public String getLemma() throws LemmatizerException { if (lemmas.size() < 1) { throw new LemmatizerException("No lemmas in array"); } return lemmas.get(0); }
public String getLemma() throws InstrumentCombinationException{ if(lemmas != null && lemmas.size() == 1){ return lemmas.get(0); }else{ throw new InstrumentCombinationException("this token has more than a single lemma"); } } /**
/** * redraw the tree and text in the "Selected Tree" pane * @throws ClassifierException * @throws VisualTracingToolException * @throws TeEngineMlException * @throws TreeAndParentMapException */ private void redrawCurrentSingleTreePane() throws ClassifierException, VisualTracingToolException, TeEngineMlException, TreeAndParentMapException { // double check if ((underLyingSystem != null) && (currentDisplayedTreeComponent != null) && (selectedTreeNextStack != null)) { // calc the index of the current component in the sequence of operations the user had selected in the "Existing Trees" pane SingleTreeComponent firstComponent = selectedTreeNextStack.isEmpty() ? currentDisplayedTreeComponent : selectedTreeNextStack.firstElement(); int ndxOfCurrentTreeComponent = firstComponent.getHistory().getComponents().size() - selectedTreeNextStack.size() -1; displaySingleTree(firstComponent, currentDisplayedTreeComponent, ndxOfCurrentTreeComponent); } }
displaySingleTree(treeComponent, treeComponent, treeComponent.getHistory().getComponents().size()-1);
@Override public Map<Integer, Double> updateFeatureVector( Map<Integer, Double> originalFeatureVector, FeatureUpdate featureUpdate, TreeAndParentMap<ExtendedInfo, ExtendedNode> textTree, TreeAndParentMap<ExtendedInfo, ExtendedNode> hypothesisTree, GenerationOperation<ExtendedInfo, ExtendedNode> operation, RuleSubstituteNodeSpecification<ChainOfLexicalRules> specification) throws TeEngineMlException { List<ConfidenceChainItem> chain = new ArrayList<ConfidenceChainItem>(specification.getRule().getChain().size()); for (LexicalRuleWithName lexicalRule : specification.getRule().getChain()) { chain.add( new ConfidenceChainItem(lexicalRule.getRuleBaseName(),lexicalRule.getRule().getConfidence())); } return featureUpdate.forChainOfRules(originalFeatureVector, new ImmutableListWrapper<ConfidenceChainItem>(chain)); }
logger.debug("costProfitGain = "+childElement.getCostProfitGain()+". History size = "+childElement.getHistory().getSpecifications().size());
public static <I, S extends AbstractNode<I,S>> ChainOfRulesWithConfidenceAndDescription<I,S> fromChainOfLexicalRules(ChainOfLexicalRules chain, RuleWithConfidenceAndDescription<I, S> rule) { ArrayList<ConfidenceChainItem> list = new ArrayList<ConfidenceChainItem>(chain.getChain().size()); for (LexicalRuleWithName lexicalRule : chain.getChain()) { list.add(new ConfidenceChainItem(lexicalRule.getRuleBaseName(), lexicalRule.getRule().getConfidence())); } return new ChainOfRulesWithConfidenceAndDescription<I, S>( rule.getRule(), rule.getConfidence(), rule.getDescription()+": "+createDescription(chain), new ImmutableListWrapper<ConfidenceChainItem>(list)); }
if (historyComponentsIndex == historyComponents.size()) // if we are after clicking the "Perform Regular Search" button but before clicking Next/Previous
if (historyComponentsIndex < (historyComponents.size() - 1)) { ++historyComponentsIndex; redrawRegularSeachTreeAfterUpdatingTheComponentIndex(); if (historyComponentsIndex < (historyComponents.size() - 1)) { historyComponentsIndex = historyComponents.size() - 1; redrawRegularSeachTreeAfterUpdatingTheComponentIndex();
new TreeAndParentMap<ExtendedInfo, ExtendedNode>(generatedTree.getTree()); TreeHistory history = generatedTreesHistory.get(generatedTree); Specification lastSpec = history.getSpecifications().get(history.getSpecifications().size()-1);
public ChainOfLexicalRules(String lhsLemma, PartOfSpeech lhsPos, String rhsLemma, PartOfSpeech rhsPos, double confidence, ImmutableList<LexicalRuleWithName> chain) throws TeEngineMlException { super(lhsLemma, lhsPos, rhsLemma, rhsPos, confidence); this.chain = chain; if (null==chain) throw new TeEngineMlException("Null chain"); if (chain.size()==0)throw new TeEngineMlException("Empty chain"); if (!chain.get(0).getRule().getLhsLemma().equals(lhsLemma)) throw new TeEngineMlException("Bad chain: expected: "+lhsLemma+" but found: "+chain.get(0).getRule().getLhsLemma()+parametersDescription(lhsLemma, lhsPos, rhsLemma, rhsPos, confidence, chain)); if (!simplerPos(chain.get(0).getRule().getLhsPos().getCanonicalPosTag()).equals(simplerPos(lhsPos.getCanonicalPosTag()))) throw new TeEngineMlException("Bad chain: expected pos: "+simplerPos(lhsPos.getCanonicalPosTag())+", but found: "+simplerPos(chain.get(0).getRule().getLhsPos().getCanonicalPosTag())+parametersDescription(lhsLemma, lhsPos, rhsLemma, rhsPos, confidence, chain)); if (!chain.get(chain.size()-1).getRule().getRhsLemma().equals(rhsLemma)) throw new TeEngineMlException("Bad chain: expected rhsLemma: "+rhsLemma+" but found: "+chain.get(chain.size()-1).getRule().getRhsLemma()+parametersDescription(lhsLemma, lhsPos, rhsLemma, rhsPos, confidence, chain)); if (!simplerPos(chain.get(chain.size()-1).getRule().getRhsPos().getCanonicalPosTag()).equals(simplerPos(rhsPos.getCanonicalPosTag()))) throw new TeEngineMlException("Bad chain: expected rhs pos: "+simplerPos(rhsPos.getCanonicalPosTag())+", but found: "+simplerPos(chain.get(chain.size()-1).getRule().getRhsPos().getCanonicalPosTag())+parametersDescription(lhsLemma, lhsPos, rhsLemma, rhsPos, confidence, chain)); }
new TreeAndParentMap<ExtendedInfo, ExtendedNode>(generatedTree.getTree()); TreeHistory history = generatedTreesHistory.get(generatedTree); Specification lastSpec = history.getSpecifications().get(history.getSpecifications().size()-1);
logger.debug("Already examined: "+specsHistory.get(specsHistory.size()-1).toString());
TreeHistory history = generatedTreesHistory.get(generatedTree); if (null==history) throw new TeEngineMlException("BUG"); Specification lastSpec = history.getSpecifications().get(history.getSpecifications().size()-1);
LexicalRuleWithName lexicalRuleWithName = fromInfrastructureLexicalRule(rule,resourceEntry.getKey()); int newChainLength = 1; if (rhs.getChain()!=null){newChainLength+=rhs.getChain().getChain().size();} List<LexicalRuleWithName> newChain = new ArrayList<LexicalRuleWithName>(newChainLength); newChain.add(lexicalRuleWithName);
TreeAndParentMap<ExtendedInfo, ExtendedNode> treeAndParentMap = new TreeAndParentMap<ExtendedInfo, ExtendedNode>(generatedTree.getTree()); int sizeOfSpecs = generator.getHistoryMap().get(generatedTree).getSpecifications().size(); Specification lastSpec = generator.getHistoryMap().get(generatedTree).getSpecifications().get(sizeOfSpecs-1); double classificationScore = classifier.classify(generatedTree.getFeatureVector());
Specification lastSpec = history.getSpecifications().get(history.getSpecifications().size()-1);
this.bestTreeHistory = processor.getBestTreeHistory(); this.historyComponents = processor.getBestTreeHistory().getComponents(); this.historyComponentsIndex = historyComponents.size();