Beispiel #1
0
        protected override bool IsSegmentMatch(Segment seg)
        {
            if (m_natClass.NumSegmentDefinitions == 0)
            {
                return(true);
            }

            foreach (SegmentDefinition segDef in m_natClass.SegmentDefinitions)
            {
                if (seg.IsSegmentInstantiated(segDef))
                {
                    return(true);
                }
            }
            return(false);
        }
Beispiel #2
0
 protected override bool IsSegmentMatch(Segment seg)
 {
     return(seg.IsSegmentInstantiated(m_segDef));
 }
Beispiel #3
0
		protected override bool IsSegmentMatch(Segment seg)
		{
			return seg.IsSegmentInstantiated(m_segDef);
		}
Beispiel #4
0
            public IList <Match> Search(PhoneticShapeNode node, Direction dir, bool partialMatch)
            {
                IList <Match> matches = null;

                switch (node.Type)
                {
                case PhoneticShapeNode.NodeType.MARGIN:
                    if (node == node.Owner.GetLast(dir))
                    {
                        matches = new List <Match>();
                        if (!partialMatch)
                        {
                            // we are at the end of the phonetic shape, so return
                            // all values in this node
                            foreach (T value in m_values)
                            {
                                matches.Add(new Match(value));
                            }
                        }
                    }
                    else
                    {
                        // skip the first margin
                        matches = Search(node.GetNext(dir), dir, partialMatch);
                    }
                    break;

                case PhoneticShapeNode.NodeType.BOUNDARY:
                    // skip boundaries
                    matches = Search(node.GetNext(dir), dir, partialMatch);
                    foreach (Match match in matches)
                    {
                        match.AddNode(node);
                    }
                    break;

                case PhoneticShapeNode.NodeType.SEGMENT:
                    Segment           seg        = (Segment)node;
                    PhoneticShapeNode nextNode   = node.GetNext(dir);
                    List <Match>      segMatches = new List <Match>();
                    foreach (TrieNode child in m_children)
                    {
                        // check for unifiability when searching
                        if (seg.FeatureValues.FeatureSystem.HasFeatures)
                        {
                            if (seg.FeatureValues.IsUnifiable(child.m_segDef.SynthFeatures))
                            {
                                segMatches.AddRange(child.Search(nextNode, dir, partialMatch));
                            }
                        }
                        else if (seg.IsSegmentInstantiated(child.m_segDef))
                        {
                            segMatches.AddRange(child.Search(nextNode, dir, partialMatch));
                        }
                    }

                    // if this is an optional node, we can try skipping it
                    if (node.IsOptional)
                    {
                        segMatches.AddRange(Search(nextNode, dir, partialMatch));
                    }

                    matches = segMatches;

                    foreach (Match match in matches)
                    {
                        match.AddNode(node);
                    }
                    break;
                }

                if (partialMatch)
                {
                    foreach (T value in m_values)
                    {
                        matches.Add(new Match(value));
                    }
                }

                return(matches);
            }
Beispiel #5
0
		protected override bool IsSegmentMatch(Segment seg)
		{
			if (m_natClass.NumSegmentDefinitions == 0)
				return true;

			foreach (SegmentDefinition segDef in m_natClass.SegmentDefinitions)
			{
				if (seg.IsSegmentInstantiated(segDef))
					return true;
			}
			return false;
		}