Beispiel #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>();
        }
Beispiel #2
0
		/// <summary>
		/// Copy constructor.
		/// </summary>
		/// <param name="wa">The word analysis.</param>
		public WordAnalysis(WordAnalysis wa)
		{
			m_shape = wa.m_shape.Clone();
			m_pos = new HCObjectSet<PartOfSpeech>(wa.m_pos);
			m_rootAllomorph = wa.m_rootAllomorph;
			if (wa.m_nonHead != null)
				m_nonHead = wa.m_nonHead.Clone();
			m_mrules = new List<MorphologicalRule>(wa.m_mrules);
			m_mrulesUnapplied = new Dictionary<MorphologicalRule, int>(wa.m_mrulesUnapplied);
			m_rzFeatures = wa.m_rzFeatures.Clone();
			m_curTrace = wa.m_curTrace;
			m_stratum = wa.m_stratum;
		}
Beispiel #3
0
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="wa">The word analysis.</param>
 public WordAnalysis(WordAnalysis wa)
 {
     m_shape         = wa.m_shape.Clone();
     m_pos           = new HCObjectSet <PartOfSpeech>(wa.m_pos);
     m_rootAllomorph = wa.m_rootAllomorph;
     if (wa.m_nonHead != null)
     {
         m_nonHead = wa.m_nonHead.Clone();
     }
     m_mrules          = new List <MorphologicalRule>(wa.m_mrules);
     m_mrulesUnapplied = new Dictionary <MorphologicalRule, int>(wa.m_mrulesUnapplied);
     m_rzFeatures      = wa.m_rzFeatures.Clone();
     m_curTrace        = wa.m_curTrace;
     m_stratum         = wa.m_stratum;
 }
Beispiel #4
0
		/// <summary>
		/// Initializes a new instance of the <see cref="WordSynthesisTrace"/> class.
		/// </summary>
		/// <param name="rootAllomorph">The root allomorph.</param>
		/// <param name="mrules">The morphological rules.</param>
		/// <param name="rzFeatures">The realizational features.</param>
		internal WordSynthesisTrace(LexEntry.RootAllomorph rootAllomorph, IEnumerable<MorphologicalRule> mrules, FeatureValues rzFeatures)
		{
			m_rootAllomorph = rootAllomorph;
			m_mrules = new List<MorphologicalRule>(mrules);
			m_rzFeatures = rzFeatures;
		}
Beispiel #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WordSynthesisTrace"/> class.
 /// </summary>
 /// <param name="rootAllomorph">The root allomorph.</param>
 /// <param name="mrules">The morphological rules.</param>
 /// <param name="rzFeatures">The realizational features.</param>
 internal WordSynthesisTrace(LexEntry.RootAllomorph rootAllomorph, IEnumerable <MorphologicalRule> mrules, FeatureValues rzFeatures)
 {
     m_rootAllomorph = rootAllomorph;
     m_mrules        = new List <MorphologicalRule>(mrules);
     m_rzFeatures    = rzFeatures;
 }
Beispiel #6
0
		void LoadAllomorph(XmlElement alloNode, LexEntry entry, Stratum stratum)
		{
			string alloId = alloNode.GetAttribute("id");
			string shapeStr = alloNode.SelectSingleNode("PhoneticShape").InnerText;
			PhoneticShape shape = stratum.CharacterDefinitionTable.ToPhoneticShape(shapeStr, ModeType.SYNTHESIS);
			if (shape == null)
			{
				LoadException le = new LoadException(LoadException.LoadErrorType.INVALID_ENTRY_SHAPE, this,
					string.Format(HCStrings.kstidInvalidLexEntryShape, shapeStr, entry.ID, stratum.CharacterDefinitionTable.ID));
				le.Data["shape"] = shapeStr;
				le.Data["charDefTable"] = stratum.CharacterDefinitionTable.ID;
				le.Data["entry"] = entry.ID;
				throw le;
			}
			LexEntry.RootAllomorph allomorph = new LexEntry.RootAllomorph(alloId, shapeStr, m_curMorpher, shape);
			allomorph.RequiredEnvironments = LoadEnvs(alloNode.SelectSingleNode("RequiredEnvironments"));
			allomorph.ExcludedEnvironments = LoadEnvs(alloNode.SelectSingleNode("ExcludedEnvironments"));
			allomorph.Properties = LoadProperties(alloNode.SelectSingleNode("Properties"));
			entry.AddAllomorph(allomorph);

			m_curMorpher.AddAllomorph(allomorph);
		}
Beispiel #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WordSynthesis"/> class.
 /// </summary>
 /// <param name="rootAllomorph">The root allomorph.</param>
 /// <param name="rzFeatures">The realizational features.</param>
 /// <param name="curTrace">The current trace record.</param>
 internal WordSynthesis(LexEntry.RootAllomorph rootAllomorph, FeatureValues rzFeatures, Trace curTrace)
     : this(rootAllomorph, null, rzFeatures, new MorphologicalRule[] {}, curTrace)
 {
 }