Esempio n. 1
0
        public void AddEos()
        {
            var eosNode = new ViterbiNode(-1, EOS, 0, 0, 0, Dimension - 1, ViterbiNode.NodeType.Known);

            AddNode(eosNode, Dimension - 1, 0);
        }
Esempio n. 2
0
        public void AddBos()
        {
            var bosNode = new ViterbiNode(-1, BOS, 0, 0, 0, -1, ViterbiNode.NodeType.Known);

            AddNode(bosNode, 0, 1);
        }
Esempio n. 3
0
 string GetNodeId(ViterbiNode node)
 {
     return(node.GetHashCode().ToString());
 }
Esempio n. 4
0
 int GetCost(ViterbiNode from, ViterbiNode to)
 {
     return(Costs[from.LeftId, to.RightId]);
 }
Esempio n. 5
0
 /// <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);
 }