/// <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); }
/// <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); }
/// <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++; } }
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; } }
/// <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; } } }
/// <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; }
/// <summary> /// Adds the morphological rule. /// </summary> /// <param name="rule">The morphological rule.</param> public void AddRule(MorphologicalRule rule) { m_rules.Add(rule); }
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())); } }
public abstract void MorphologicalRuleNotUnapplied(MorphologicalRule rule, WordAnalysis input);
public override void MorphologicalRuleNotApplied(MorphologicalRule rule, WordSynthesis input) { if (IsSynthesisTracingEnabled(rule.ID)) ((Trace) input.CurrentTraceObject).AddChild(new MorphologicalRuleSynthesisTrace(rule, input.Clone())); }
/// <summary> /// Adds the morphological rule. /// </summary> /// <param name="mrule">The morphological rule.</param> public void AddMorphologicalRule(MorphologicalRule mrule) { m_mrules.Add(mrule); }
/// <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; }
public override void MorphologicalRuleNotUnapplied(MorphologicalRule rule, WordAnalysis input) { }
public override void MorphologicalRuleNotApplied(MorphologicalRule rule, WordSynthesis input) { }
public abstract void MorphologicalRuleNotApplied(MorphologicalRule rule, WordSynthesis input);
public abstract void MorphologicalRuleApplied(MorphologicalRule rule, WordSynthesis input, WordSynthesis output, Allomorph allomorph);
/// <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; }
/// <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; }
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; } }
public abstract void MorphologicalRuleUnapplied(MorphologicalRule rule, WordAnalysis input, WordAnalysis output, Allomorph allomorph);
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); } }
/// <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); }