protected internal virtual void Combine(Edge edge, Hook hook) { // make result edge if (hook.IsPreHook()) { tempEdge.start = edge.start; tempEdge.end = hook.end; } else { tempEdge.start = hook.start; tempEdge.end = edge.end; } tempEdge.state = hook.state; tempEdge.head = hook.head; tempEdge.tag = hook.tag; tempEdge.iScore = hook.iScore + edge.iScore; tempEdge.backEdge = edge; tempEdge.backHook = hook; RelaxTempEdge(); }
protected internal virtual double BuildOScore(Hook hook) { double bestOScore = double.NegativeInfinity; Edge iTemp = new Edge(op.testOptions.exhaustiveTest); Edge oTemp = new Edge(op.testOptions.exhaustiveTest); iTemp.head = hook.head; iTemp.tag = hook.tag; iTemp.state = hook.subState; oTemp.head = hook.head; oTemp.tag = hook.tag; oTemp.state = hook.state; if (hook.IsPreHook()) { iTemp.end = hook.start; oTemp.end = hook.end; for (int start = 0; start <= hook.head; start++) { iTemp.start = start; oTemp.start = start; double oScore = scorer.OScore(oTemp) + scorer.IScore(iTemp); //log.info("Score for "+hook+" is i "+iTemp+" ("+scorer.iScore(iTemp)+") o "+oTemp+" ("+scorer.oScore(oTemp)+")"); bestOScore = SloppyMath.Max(bestOScore, oScore); } } else { iTemp.start = hook.end; oTemp.start = hook.start; for (int end = hook.head + 1; end <= length; end++) { iTemp.end = end; oTemp.end = end; double oScore = scorer.OScore(oTemp) + scorer.IScore(iTemp); bestOScore = SloppyMath.Max(bestOScore, oScore); } } return(bestOScore); }
public virtual void AddHook(Hook hook) { IDictionary <HookChart.ChartIndex, IList <Hook> > map; tempIndex.state = hook.subState; tempIndex.head = hook.head; tempIndex.tag = hook.tag; if (hook.IsPreHook()) { tempIndex.loc = hook.start; map = registeredPreHooks; } else { tempIndex.loc = hook.end; map = registeredPostHooks; } HookChart.ChartIndex index = (HookChart.ChartIndex)interner.Intern(tempIndex); Insert(map, index, hook); if (index == tempIndex) { tempIndex = new HookChart.ChartIndex(); } }
public virtual ICollection <Edge> GetEdges(Hook hook) { tempIndex.state = hook.subState; tempIndex.head = hook.head; tempIndex.tag = hook.tag; ICollection <Edge> result; if (hook.IsPreHook()) { tempIndex.loc = hook.start; result = registeredEdgesByRightIndex[tempIndex]; } else { tempIndex.loc = hook.end; result = registeredEdgesByLeftIndex[tempIndex]; } if (result == null) { result = empty; } //System.out.println("For "+hook+" returning "+result.size()+" edges"); return(result); }
public virtual bool IPossible(Hook hook) { return(hook.IsPreHook() ? iPossibleByR[hook.start][hook.head][dg.TagBin(hook.tag)] : iPossibleByL[hook.end][hook.head][dg.TagBin(hook.tag)]); }