public void AddEos() { var eosNode = new ViterbiNode(-1, EOS, 0, 0, 0, Dimension - 1, ViterbiNode.NodeType.Known); AddNode(eosNode, Dimension - 1, 0); }
public void AddBos() { var bosNode = new ViterbiNode(-1, BOS, 0, 0, 0, -1, ViterbiNode.NodeType.Known); AddNode(bosNode, 0, 1); }
string GetNodeId(ViterbiNode node) { return(node.GetHashCode().ToString()); }
int GetCost(ViterbiNode from, ViterbiNode to) { return(Costs[from.LeftId, to.RightId]); }
/// <summary> /// Check whether a candidate for a glue node is acceptable. /// The candidate should be as short as possible, but long enough to overlap with the inserted user entry /// </summary> /// <param name="targetLength"></param> /// <param name="glueBase"></param> /// <param name="candidate"></param> /// <returns></returns> bool IsAcceptableCandidate(int targetLength, ViterbiNode glueBase, ViterbiNode candidate) { return((glueBase == null || candidate.Surface.Length < glueBase.Surface.Length) && candidate.Surface.Length >= targetLength); }