예제 #1
0
			void ApplyInsertion(Direction dir, IList<PhoneticShapeNode> match, VariableValues instantiatedVars)
			{
				PhoneticShapeNode cur = match[match.Count - 1];
				for (PhoneticPatternNode pseqNode = m_rhs.GetFirst(dir); pseqNode != null;
					pseqNode = pseqNode.GetNext(dir))
				{
					PhoneticShapeNode newNode = null;
					switch (pseqNode.Type)
					{
						case PhoneticPatternNode.NodeType.SIMP_CTXT:
							SimpleContext ctxt = pseqNode as SimpleContext;
							newNode = ctxt.ApplyInsertion(instantiatedVars);
							break;

						case PhoneticPatternNode.NodeType.BDRY_CTXT:
							newNode = new Boundary(pseqNode as BoundaryContext);
							break;
					}

					if (newNode != null)
					{
						try
						{
							cur.Insert(newNode, dir);
						}
						catch (InvalidOperationException ioe)
						{
							MorphException me = new MorphException(MorphException.MorphErrorType.TOO_MANY_SEGS, m_rule.Morpher,
								string.Format(HCStrings.kstidTooManySegs, m_rule.ID), ioe);
							me.Data["rule"] = m_rule.ID;
							throw me;
						}
						cur = newNode;
					}
				}
			}
예제 #2
0
		PhoneticShapeNode GetPhoneticShapeNode(string strRep, ModeType mode)
		{
			PhoneticShapeNode node = null;
			SegmentDefinition segDef = GetSegmentDefinition(strRep);
			if (segDef != null)
			{
				Segment seg = new Segment(segDef, mode == ModeType.SYNTHESIS ? segDef.SynthFeatures.Clone() : segDef.AnalysisFeatures.Clone());
				if (!Morpher.PhoneticFeatureSystem.HasFeatures)
					seg.InstantiateSegment(segDef);
				node = seg;
			}
			else
			{
				BoundaryDefinition bdryDef = GetBoundaryDefinition(strRep);
				if (bdryDef != null)
					node = new Boundary(bdryDef);
			}
			return node;
		}
예제 #3
0
		/// <summary>
		/// Copy constructor.
		/// </summary>
		/// <param name="bdry">The bdry.</param>
		public Boundary(Boundary bdry)
			: base(bdry)
		{
			m_bdryDef = bdry.m_bdryDef;
		}
예제 #4
0
		public bool Equals(Boundary other)
		{
			if (other == null)
				return false;
			return m_bdryDef.Equals(other.m_bdryDef);
		}
예제 #5
0
		/// <summary>
		/// Initializes a new instance of the <see cref="BoundaryContext"/> class from a boundary
		/// object.
		/// </summary>
		/// <param name="bdry">The bdry.</param>
		public BoundaryContext(Boundary bdry)
		{
			m_bdryDef = bdry.BoundaryDefinition;
		}