/// <summary> /// Initializes a new instance of the <see cref="Subrule"/> class. /// </summary> /// <param name="id">The id.</param> /// <param name="desc">The description.</param> /// <param name="morpher">The morpher.</param> /// <param name="headLhs">The head LHS.</param> /// <param name="nonHeadLhs">The non-head LHS.</param> /// <param name="rhs">The RHS.</param> /// <param name="alphaVars">The alpha variables.</param> public Subrule(string id, string desc, Morpher morpher, IEnumerable<PhoneticPattern> headLhs, IEnumerable<PhoneticPattern> nonHeadLhs, IEnumerable<MorphologicalOutput> rhs, AlphaVariables alphaVars) : base (id, desc, morpher) { m_alphaVars = alphaVars; List<PhoneticPattern> lhs = new List<PhoneticPattern>(); lhs.AddRange(headLhs); lhs.AddRange(nonHeadLhs); m_transform = new MorphologicalTransform(lhs, rhs, MorphologicalTransform.RedupMorphType.IMPLICIT); // the LHS template is generated by simply concatenating all of the // LHS partitions; it matches the entire word, so we check for both the // left and right margins. m_headLhsTemp = new PhoneticPattern(); m_headLhsTemp.Add(new MarginContext(Direction.LEFT)); int partition = 0; foreach (PhoneticPattern pat in headLhs) m_headLhsTemp.AddPartition(pat, partition++); m_headLhsTemp.Add(new MarginContext(Direction.RIGHT)); m_firstNonHeadPartition = partition; m_nonHeadLhsTemp = new PhoneticPattern(); m_nonHeadLhsTemp.Add(new MarginContext(Direction.LEFT)); foreach (PhoneticPattern pat in nonHeadLhs) m_nonHeadLhsTemp.AddPartition(pat, partition++); m_nonHeadLhsTemp.Add(new MarginContext(Direction.RIGHT)); }
/// <summary> /// Initializes a new instance of the <see cref="Subrule"/> class. /// </summary> /// <param name="id">The id.</param> /// <param name="desc">The description.</param> /// <param name="morpher">The morpher.</param> /// <param name="headLhs">The head LHS.</param> /// <param name="nonHeadLhs">The non-head LHS.</param> /// <param name="rhs">The RHS.</param> /// <param name="alphaVars">The alpha variables.</param> public Subrule(string id, string desc, Morpher morpher, IEnumerable <PhoneticPattern> headLhs, IEnumerable <PhoneticPattern> nonHeadLhs, IEnumerable <MorphologicalOutput> rhs, AlphaVariables alphaVars) : base(id, desc, morpher) { m_alphaVars = alphaVars; List <PhoneticPattern> lhs = new List <PhoneticPattern>(); lhs.AddRange(headLhs); lhs.AddRange(nonHeadLhs); m_transform = new MorphologicalTransform(lhs, rhs, MorphologicalTransform.RedupMorphType.IMPLICIT); // the LHS template is generated by simply concatenating all of the // LHS partitions; it matches the entire word, so we check for both the // left and right margins. m_headLhsTemp = new PhoneticPattern(); m_headLhsTemp.Add(new MarginContext(Direction.LEFT)); int partition = 0; foreach (PhoneticPattern pat in headLhs) { m_headLhsTemp.AddPartition(pat, partition++); } m_headLhsTemp.Add(new MarginContext(Direction.RIGHT)); m_firstNonHeadPartition = partition; m_nonHeadLhsTemp = new PhoneticPattern(); m_nonHeadLhsTemp.Add(new MarginContext(Direction.LEFT)); foreach (PhoneticPattern pat in nonHeadLhs) { m_nonHeadLhsTemp.AddPartition(pat, partition++); } m_nonHeadLhsTemp.Add(new MarginContext(Direction.RIGHT)); }
/// <summary> /// Initializes a new instance of the <see cref="Subrule"/> class. /// </summary> /// <param name="id">The id.</param> /// <param name="desc">The description.</param> /// <param name="morpher">The morpher.</param> /// <param name="lhs">The LHS.</param> /// <param name="rhs">The RHS.</param> /// <param name="alphaVars">The alpha variables.</param> /// <param name="redupMorphType">The full reduplication type.</param> public Subrule(string id, string desc, Morpher morpher, IEnumerable<PhoneticPattern> lhs, IEnumerable<MorphologicalOutput> rhs, AlphaVariables alphaVars, MorphologicalTransform.RedupMorphType redupMorphType) : base (id, desc, morpher) { m_alphaVars = alphaVars; m_transform = new MorphologicalTransform(lhs, rhs, redupMorphType); // the LHS template is generated by simply concatenating all of the // LHS partitions; it matches the entire word, so we check for both the // left and right margins. m_lhsTemp = new PhoneticPattern(); m_lhsTemp.Add(new MarginContext(Direction.LEFT)); int partition = 0; foreach (PhoneticPattern pat in lhs) { m_lhsTemp.AddPartition(pat, partition, m_transform.IsGreedy(partition)); partition++; } m_lhsTemp.Add(new MarginContext(Direction.RIGHT)); }
/// <summary> /// Initializes a new instance of the <see cref="Subrule"/> class. /// </summary> /// <param name="id">The id.</param> /// <param name="desc">The description.</param> /// <param name="morpher">The morpher.</param> /// <param name="lhs">The LHS.</param> /// <param name="rhs">The RHS.</param> /// <param name="alphaVars">The alpha variables.</param> /// <param name="redupMorphType">The full reduplication type.</param> public Subrule(string id, string desc, Morpher morpher, IEnumerable <PhoneticPattern> lhs, IEnumerable <MorphologicalOutput> rhs, AlphaVariables alphaVars, MorphologicalTransform.RedupMorphType redupMorphType) : base(id, desc, morpher) { m_alphaVars = alphaVars; m_transform = new MorphologicalTransform(lhs, rhs, redupMorphType); // the LHS template is generated by simply concatenating all of the // LHS partitions; it matches the entire word, so we check for both the // left and right margins. m_lhsTemp = new PhoneticPattern(); m_lhsTemp.Add(new MarginContext(Direction.LEFT)); int partition = 0; foreach (PhoneticPattern pat in lhs) { m_lhsTemp.AddPartition(pat, partition, m_transform.IsGreedy(partition)); partition++; } m_lhsTemp.Add(new MarginContext(Direction.RIGHT)); }