예제 #1
0
 protected DecisionNode(string feature, object value, int qtrue, int qfalse)
     : base(value)
 {
     path        = new PathExtractor(feature, true);
     this.qtrue  = qtrue;
     this.qfalse = qfalse;
 }
예제 #2
0
        /// <summary>
        /// Returns the Item in the given Relation associated with the given time.
        /// </summary>
        /// <param name="relation">The name of the relation.</param>
        /// <param name="time">The time.</param>
        /// <returns></returns>
        /// <exception>if the Segment durations have not been
        /// calculated in the Utterance or if the given relation is not
        /// present in the Utterance</exception>
        public virtual Item getItem(string relation, float time)
        {
            Relation segmentRelation = null;
            string   pathName        = null;

            if (relation.Equals(Relation.WORD))
            {
                pathName = "R:SylStructure.parent.parent.R:Word";
            }
            else if (relation.Equals(Relation.TOKEN))
            {
                pathName = "R:SylStructure.parent.parent.R:Token.parent";
            }
            else
            {
                throw new ArgumentException(
                          "Utterance.getItem(): relation cannot be " + relation);
            }

            PathExtractor path = new PathExtractor(pathName, false);

            // get the Item in the Segment Relation with the given time
            Item segmentItem = getItem(segmentRelation, time);

            if (segmentItem != null)
            {
                return(path.findItem(segmentItem));
            }
            else
            {
                return(null);
            }
        }