Ejemplo n.º 1
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;

            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));
            }
            return(null);
        }
Ejemplo n.º 2
0
 protected DecisionNode(string feature, object value, int qtrue, int qfalse)
     : base(value)
 {
     _path  = new PathExtractor(feature, true);
     Qtrue  = qtrue;
     Qfalse = qfalse;
 }