예제 #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
파일: Trace.cs 프로젝트: bbriggs/FieldWorks
		/// <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
파일: Trace.cs 프로젝트: bbriggs/FieldWorks
		/// <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
파일: Trace.cs 프로젝트: bbriggs/FieldWorks
		/// <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);
 }