Пример #1
0
        /// <summary>
        /// Notifies this analysis that the specified morphological rule was unapplied.
        /// </summary>
        /// <param name="mrule">The morphological rule.</param>
        internal void MorphologicalRuleUnapplied(MorphologicalRule mrule)
        {
            int numUnapplies = GetNumUnappliesForMorphologicalRule(mrule);

            m_mrulesUnapplied[mrule] = numUnapplies + 1;
            m_mrules.Insert(0, mrule);
        }
Пример #2
0
        /// <summary>
        /// Gets the number of times the specified morphological rule has been unapplied.
        /// </summary>
        /// <param name="mrule">The morphological rule.</param>
        /// <returns>The number of unapplications.</returns>
        internal int GetNumUnappliesForMorphologicalRule(MorphologicalRule mrule)
        {
            int numUnapplies;

            if (!m_mrulesUnapplied.TryGetValue(mrule, out numUnapplies))
            {
                numUnapplies = 0;
            }
            return(numUnapplies);
        }
Пример #3
0
        /// <summary>
        /// Notifies this word synthesis that the specified morphological rule has applied.
        /// </summary>
        /// <param name="mrule">The morphological rule.</param>
        internal void MorphologicalRuleApplied(MorphologicalRule mrule)
        {
            int numApplies = GetNumAppliesForMorphologicalRule(mrule);

            m_mrulesApplied[mrule] = numApplies + 1;
            if (mrule == NextRule)
            {
                m_curRuleIndex++;
            }
        }
Пример #4
0
		public override void MorphologicalRuleUnapplied(MorphologicalRule rule, WordAnalysis input, WordAnalysis output, Allomorph allomorph)
		{
			if (IsAnalysisTracingEnabled(rule.ID))
			{
				// create the morphological rule analysis trace record for each output analysis
				var trace = new MorphologicalRuleAnalysisTrace(rule, input.Clone()) {RuleAllomorph = allomorph, Output = output.Clone()};
				((Trace) output.CurrentTraceObject).AddChild(trace);
				// set current trace record to the morphological rule trace record for each
				// output analysis
				output.CurrentTraceObject = trace;
			}
		}
Пример #5
0
        /// <summary>
        /// Turns tracing of a rule on or off.
        /// </summary>
        /// <param name="id">The rule ID.</param>
        /// <param name="traceAnalysis"><c>true</c> if tracing during analysis is on, <c>false</c>
        /// if tracing during analysis is off.</param>
        /// <param name="traceSynthesis"><c>true</c> if tracing during synthesis is on, <c>false</c>
        /// if tracing during synthesis is off.</param>
        public void SetTraceRule(string id, bool traceAnalysis, bool traceSynthesis)
        {
            PhonologicalRule prule = GetPhonologicalRule(id);

            if (prule != null)
            {
                prule.TraceAnalysis  = traceAnalysis;
                prule.TraceSynthesis = traceSynthesis;
            }
            else
            {
                MorphologicalRule mrule = GetMorphologicalRule(id);
                if (mrule != null)
                {
                    mrule.TraceAnalysis  = traceAnalysis;
                    mrule.TraceSynthesis = traceSynthesis;
                }
            }
        }
Пример #6
0
		/// <summary>
		/// Notifies this analysis that the specified morphological rule was unapplied.
		/// </summary>
		/// <param name="mrule">The morphological rule.</param>
		internal void MorphologicalRuleUnapplied(MorphologicalRule mrule)
		{
			int numUnapplies = GetNumUnappliesForMorphologicalRule(mrule);
			m_mrulesUnapplied[mrule] = numUnapplies + 1;
			m_mrules.Insert(0, mrule);
		}
Пример #7
0
		/// <summary>
		/// Gets the number of times the specified morphological rule has been unapplied.
		/// </summary>
		/// <param name="mrule">The morphological rule.</param>
		/// <returns>The number of unapplications.</returns>
		internal int GetNumUnappliesForMorphologicalRule(MorphologicalRule mrule)
		{
			int numUnapplies;
			if (!m_mrulesUnapplied.TryGetValue(mrule, out numUnapplies))
				numUnapplies = 0;
			return numUnapplies;
		}
Пример #8
0
		/// <summary>
		/// Adds the morphological rule.
		/// </summary>
		/// <param name="rule">The morphological rule.</param>
		public void AddRule(MorphologicalRule rule)
		{
			m_rules.Add(rule);
		}
Пример #9
0
		public override void MorphologicalRuleNotUnapplied(MorphologicalRule rule, WordAnalysis input)
		{
			if (IsAnalysisTracingEnabled(rule.ID))
			{
				// create the morphological rule analysis trace record for a rule that did not succesfully unapply
				((Trace) input.CurrentTraceObject).AddChild(new MorphologicalRuleAnalysisTrace(rule, input.Clone()));
			}
		}
Пример #10
0
		public abstract void MorphologicalRuleNotUnapplied(MorphologicalRule rule, WordAnalysis input);
Пример #11
0
		public override void MorphologicalRuleNotApplied(MorphologicalRule rule, WordSynthesis input)
		{
			if (IsSynthesisTracingEnabled(rule.ID))
				((Trace) input.CurrentTraceObject).AddChild(new MorphologicalRuleSynthesisTrace(rule, input.Clone()));
		}
Пример #12
0
 /// <summary>
 /// Adds the morphological rule.
 /// </summary>
 /// <param name="mrule">The morphological rule.</param>
 public void AddMorphologicalRule(MorphologicalRule mrule)
 {
     m_mrules.Add(mrule);
 }
Пример #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MorphologicalRuleSynthesisTrace"/> class.
 /// </summary>
 /// <param name="rule">The rule.</param>
 /// <param name="input">The input.</param>
 internal MorphologicalRuleSynthesisTrace(MorphologicalRule rule, WordSynthesis input)
     : base(rule)
 {
     m_input = input;
 }
Пример #14
0
			public override void MorphologicalRuleNotUnapplied(MorphologicalRule rule, WordAnalysis input)
			{
			}
Пример #15
0
		/// <summary>
		/// Adds the morphological rule.
		/// </summary>
		/// <param name="mrule">The morphological rule.</param>
		public void AddMorphologicalRule(MorphologicalRule mrule)
		{
			m_mrules.Add(mrule);
		}
Пример #16
0
			public override void MorphologicalRuleNotApplied(MorphologicalRule rule, WordSynthesis input)
			{
			}
Пример #17
0
		public abstract void MorphologicalRuleNotApplied(MorphologicalRule rule, WordSynthesis input);
Пример #18
0
		public abstract void MorphologicalRuleApplied(MorphologicalRule rule, WordSynthesis input, WordSynthesis output, Allomorph allomorph);
Пример #19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MorphologicalRuleTrace"/> class.
 /// </summary>
 /// <param name="rule">The rule.</param>
 internal MorphologicalRuleTrace(MorphologicalRule rule)
 {
     m_rule = rule;
 }
Пример #20
0
		/// <summary>
		/// Initializes a new instance of the <see cref="MorphologicalRuleAnalysisTrace"/> class.
		/// </summary>
		/// <param name="rule">The rule.</param>
		/// <param name="input">The input.</param>
		internal MorphologicalRuleAnalysisTrace(MorphologicalRule rule, WordAnalysis input)
			: base(rule)
		{
			m_input = input;
		}
Пример #21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MorphologicalRuleAnalysisTrace"/> class.
 /// </summary>
 /// <param name="rule">The rule.</param>
 /// <param name="input">The input.</param>
 internal MorphologicalRuleAnalysisTrace(MorphologicalRule rule, WordAnalysis input)
     : base(rule)
 {
     m_input = input;
 }
Пример #22
0
 /// <summary>
 /// Adds the morphological rule.
 /// </summary>
 /// <param name="rule">The morphological rule.</param>
 public void AddRule(MorphologicalRule rule)
 {
     m_rules.Add(rule);
 }
Пример #23
0
		public override void MorphologicalRuleApplied(MorphologicalRule rule, WordSynthesis input, WordSynthesis output, Allomorph allomorph)
		{
			if (IsSynthesisTracingEnabled(rule.ID))
			{
				var trace = new XElement("MorphologicalRuleSynthesisTrace",
					Write("MorphologicalRule", rule));
				if (allomorph != null)
					trace.Add(Write("RuleAllomorph", allomorph));
				if (WriteInputs)
					trace.Add(Write("Input", input));
				trace.Add(Write("Output", output));
				((XElement) output.CurrentTraceObject).Add(trace);
				output.CurrentTraceObject = trace;
			}
		}
Пример #24
0
		public abstract void MorphologicalRuleUnapplied(MorphologicalRule rule, WordAnalysis input, WordAnalysis output, Allomorph allomorph);
Пример #25
0
		/// <summary>
		/// Initializes a new instance of the <see cref="MorphologicalRuleTrace"/> class.
		/// </summary>
		/// <param name="rule">The rule.</param>
		internal MorphologicalRuleTrace(MorphologicalRule rule)
		{
			m_rule = rule;
		}
Пример #26
0
		public override void MorphologicalRuleNotApplied(MorphologicalRule rule, WordSynthesis input)
		{
			if (IsSynthesisTracingEnabled(rule.ID))
			{
				var trace = new XElement("MorphologicalRuleSynthesisTrace",
					Write("MorphologicalRule", rule));
				if (WriteInputs)
					trace.Add(Write("Input", input));
				((XElement) input.CurrentTraceObject).Add(trace);
			}
		}
Пример #27
0
		/// <summary>
		/// Initializes a new instance of the <see cref="MorphologicalRuleSynthesisTrace"/> class.
		/// </summary>
		/// <param name="rule">The rule.</param>
		/// <param name="input">The input.</param>
		internal MorphologicalRuleSynthesisTrace(MorphologicalRule rule, WordSynthesis input)
			: base(rule)
		{
			m_input = input;
		}
Пример #28
0
 /// <summary>
 /// Adds the morphological rule.
 /// </summary>
 /// <param name="mrule">The morphological rule.</param>
 public void AddMorphologicalRule(MorphologicalRule mrule)
 {
     mrule.Stratum = this;
     m_mrules.Add(mrule);
 }