Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WordSynthesis"/> class.
        /// </summary>
        /// <param name="rootAllomorph">The root allomorph.</param>
        /// <param name="nonHead">The non-head synthesis.</param>
        /// <param name="rzFeatures">The realizational features.</param>
        /// <param name="mrules">The morphological rules to apply.</param>
        /// <param name="curTrace">The current trace record.</param>
        internal WordSynthesis(LexEntry.RootAllomorph rootAllomorph, WordSynthesis nonHead, FeatureValues rzFeatures, IEnumerable <MorphologicalRule> mrules,
                               Trace curTrace)
        {
            m_root        = (LexEntry)rootAllomorph.Morpheme;
            m_mprFeatures = m_root.MPRFeatures != null?m_root.MPRFeatures.Clone() : new MPRFeatureSet();

            m_headFeatures = m_root.HeadFeatures != null?m_root.HeadFeatures.Clone() : new FeatureValues();

            m_footFeatures = m_root.FootFeatures != null?m_root.FootFeatures.Clone() : new FeatureValues();

            m_pos     = m_root.POS;
            m_stratum = m_root.Stratum;

            m_nonHead = nonHead;
            m_morphs  = new Morphs();
            Morph morph = new Morph(rootAllomorph);

            morph.Shape.AddMany(rootAllomorph.Shape.Segments);
            m_morphs.Add(morph);
            m_shape = new PhoneticShape();
            m_shape.Add(new Margin(Direction.LEFT));
            m_shape.AddPartition(rootAllomorph.Shape.Segments, morph.Partition);
            m_shape.Add(new Margin(Direction.RIGHT));

            m_obligHeadFeatures = new HCObjectSet <Feature>();
            m_mrules            = new List <MorphologicalRule>(mrules);
            m_rzFeatures        = rzFeatures;
            m_curTrace          = curTrace;
            m_mrulesApplied     = new Dictionary <MorphologicalRule, int>();
        }
Пример #2
0
        public override void Reset()
        {
            base.Reset();

            m_requiredPOSs         = null;
            m_outPOS               = null;
            m_maxNumApps           = 1;
            m_requiredHeadFeatures = null;
            m_requiredFootFeatures = null;
            m_outHeadFeatures      = null;
            m_outFootFeatures      = null;
            m_obligHeadFeatures    = null;
            m_subrules.Clear();
        }
Пример #3
0
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="ws">The word synthesis.</param>
 public WordSynthesis(WordSynthesis ws)
 {
     m_root = ws.m_root;
     if (ws.m_nonHead != null)
     {
         m_nonHead = ws.m_nonHead.Clone();
     }
     m_shape             = ws.m_shape.Clone();
     m_morphs            = ws.m_morphs.Clone();
     m_pos               = ws.m_pos;
     m_mprFeatures       = ws.m_mprFeatures.Clone();
     m_headFeatures      = ws.m_headFeatures.Clone();
     m_footFeatures      = ws.m_footFeatures.Clone();
     m_obligHeadFeatures = new HCObjectSet <Feature>(ws.m_obligHeadFeatures);
     m_mrules            = new List <MorphologicalRule>(ws.m_mrules);
     m_curRuleIndex      = ws.m_curRuleIndex;
     m_rzFeatures        = ws.m_rzFeatures.Clone();
     m_curTrace          = ws.m_curTrace;
     m_stratum           = ws.m_stratum;
     m_mrulesApplied     = new Dictionary <MorphologicalRule, int>(ws.m_mrulesApplied);
 }
Пример #4
0
		public override void Reset()
		{
			base.Reset();

			m_headRequiredPOSs = null;
			m_nonHeadRequiredPOSs = null;
			m_outPOS = null;
			m_maxNumApps = 1;
			m_headRequiredHeadFeatures = null;
			m_headRequiredFootFeatures = null;
			m_nonHeadRequiredHeadFeatures = null;
			m_nonHeadRequiredFootFeatures = null;
			m_outHeadFeatures = null;
			m_outFootFeatures = null;
			m_obligHeadFeatures = null;
			m_subrules.Clear();
		}
Пример #5
0
		/// <summary>
		/// Initializes a new instance of the <see cref="BlockingTrace"/> class.
		/// </summary>
		/// <param name="pos">The part of speech of the stem.</param>
		/// <param name="requiredPOSs">The set of parts of speech this rule requires.</param>
		internal PhonologicalRuleSynthesisRequiredPOSTrace(PartOfSpeech pos, HCObjectSet<PartOfSpeech> requiredPOSs)
		{
			PartOfSpeech = pos;
			RequiredPOSs = requiredPOSs;
		}
Пример #6
0
 /// <summary>
 /// Adds the part of speech.
 /// </summary>
 /// <param name="pos">The part of speech.</param>
 public void AddPOS(PartOfSpeech pos)
 {
     m_pos.Add(pos);
 }
Пример #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BlockingTrace"/> class.
 /// </summary>
 /// <param name="pos">The part of speech of the stem.</param>
 /// <param name="requiredPOSs">The set of parts of speech this rule requires.</param>
 internal PhonologicalRuleSynthesisRequiredPOSTrace(PartOfSpeech pos, HCObjectSet <PartOfSpeech> requiredPOSs)
 {
     PartOfSpeech = pos;
     RequiredPOSs = requiredPOSs;
 }
Пример #8
0
		/// <summary>
		/// Checks if the specified part of speech matches the set of instantiated parts of speech.
		/// </summary>
		/// <param name="pos">The part of speech.</param>
		/// <returns><c>true</c> if the specified part of speech matches, otherwise <c>false</c>.</returns>
		public bool MatchPOS(PartOfSpeech pos)
		{
			return m_pos.Count == 0 || m_pos.Contains(pos);
		}
Пример #9
0
		/// <summary>
		/// Adds the part of speech.
		/// </summary>
		/// <param name="pos">The part of speech.</param>
		internal void AddPOS(PartOfSpeech pos)
		{
			m_pos.Add(pos);
		}
Пример #10
0
		/// <summary>
		/// Adds the part of speech.
		/// </summary>
		/// <param name="pos">The part of speech.</param>
		public void AddPOS(PartOfSpeech pos)
		{
			m_pos.Add(pos);
		}
Пример #11
0
 /// <summary>
 /// Checks if the specified part of speech matches the set of instantiated parts of speech.
 /// </summary>
 /// <param name="pos">The part of speech.</param>
 /// <returns><c>true</c> if the specified part of speech matches, otherwise <c>false</c>.</returns>
 public bool MatchPOS(PartOfSpeech pos)
 {
     return(m_pos.Count == 0 || m_pos.Contains(pos));
 }
Пример #12
0
 /// <summary>
 /// Adds the part of speech.
 /// </summary>
 /// <param name="pos">The part of speech.</param>
 internal void AddPOS(PartOfSpeech pos)
 {
     m_pos.Add(pos);
 }