Exemple #1
0
 /**
  * /// Connect the entry points that match the given rc to the given epNode
  *
  * /// @param epNode add matching successors here
  * /// @param rc     the next unit
  */
 private void ConnectEntryPointNode(Node epNode, Unit rc)
 {
     foreach (Node node in Node.GetSuccessors())
     {
         UnitNode successor = (UnitNode)node;
         if (successor.BaseUnit == rc)
         {
             epNode.AddSuccessor(successor);
         }
     }
 }
Exemple #2
0
        /// <summary>
        /// Adds a child node to the successor.  If a node similar to the child has already been added, we use the previously
        /// added node, otherwise we add this. Also, we record the base unit of the child in the set of right context
        /// </summary>
        /// <param name="child">the child to add</param>
        /// <returns>the node (may be different than child if there was already a node attached holding the hmm held by
        ///         child)</returns>
        public UnitNode AddSuccessor(UnitNode child)
        {
            if (child == null)
            {
                return(null);
            }
            UnitNode matchingChild = (UnitNode)GetSuccessor(child.Key);

            if (matchingChild == null)
            {
                PutSuccessor(child.Key, child);
            }
            else
            {
                child = matchingChild;
            }

            return(child);
        }
        /**
         * /// Determines the insertion probability for the given unit lex node
         *
         * /// @param unitNode the unit lex node
         * /// @return the insertion probability
         */
        public float CalculateInsertionProbability(UnitNode unitNode)
        {
            int type = unitNode.Type;

            if (type == UnitNode.SimpleUnit)
            {
                return(_logUnitInsertionProbability);
            }
            if (type == UnitNode.WordBeginningUnit)
            {
                return(_logUnitInsertionProbability + _logWordInsertionProbability);
            }
            if (type == UnitNode.SilenceUnit)
            {
                return(_logSilenceInsertionProbability);
            }
            // must be filler
            return(_logFillerInsertionProbability);
        }