Esempio n. 1
0
 public void PhonologicalRuleNotUnapplied(IPhonologicalRule rule, int subruleIndex, Word input)
 {
     ((XElement)input.CurrentTrace).Add(new XElement("PhonologicalRuleAnalysisTrace",
                                                     CreateHCRuleElement("PhonologicalRule", rule),
                                                     CreateWordElement("Input", input, true),
                                                     CreateWordElement("Output", input, true)));
 }
Esempio n. 2
0
		public void PhonologicalRuleNotUnapplied(IPhonologicalRule rule, int subruleIndex, Word input)
		{
			((XElement) input.CurrentTrace).Add(new XElement("PhonologicalRuleAnalysisTrace",
				CreateHCRuleElement("PhonologicalRule", rule),
				CreateWordElement("Input", input, true),
				CreateWordElement("Output", input, true)));
		}
Esempio n. 3
0
 public void PhonologicalRuleApplied(IPhonologicalRule rule, int subruleIndex, Word input, Word output)
 {
     ((XElement)output.CurrentTrace).Add(new XElement("PhonologicalRuleSynthesisTrace",
                                                      CreateHCRuleElement("PhonologicalRule", rule),
                                                      CreateWordElement("Input", input, false),
                                                      CreateWordElement("Output", output, false)));
 }
Esempio n. 4
0
        public void PhonologicalRuleNotApplied(IPhonologicalRule rule, int subruleIndex, Word input, FailureReason reason, object failureObj)
        {
            var pruleTrace = new XElement("PhonologicalRuleSynthesisTrace",
                                          CreateHCRuleElement("PhonologicalRule", rule),
                                          CreateWordElement("Input", input, false),
                                          CreateWordElement("Output", input, false));

            var rewriteRule = rule as RewriteRule;

            if (rewriteRule != null)
            {
                RewriteSubrule sr = rewriteRule.Subrules[subruleIndex];
                switch (reason)
                {
                case FailureReason.RequiredSyntacticFeatureStruct:
                    pruleTrace.Add(new XElement("FailureReason", new XAttribute("type", "category"),
                                                new XElement("Category", input.SyntacticFeatureStruct.PartsOfSpeech().FirstOrDefault()),
                                                new XElement("RequiredCategories", sr.RequiredSyntacticFeatureStruct.PartsOfSpeech()
                                                             .Select(pos => new XElement("Category", pos)))));
                    break;

                case FailureReason.RequiredMprFeatures:
                    pruleTrace.Add(CreateMprFeaturesFailureElement(true, (MprFeatureGroup)failureObj, sr.RequiredMprFeatures, input));
                    break;

                case FailureReason.ExcludedMprFeatures:
                    pruleTrace.Add(CreateMprFeaturesFailureElement(false, (MprFeatureGroup)failureObj, sr.ExcludedMprFeatures, input));
                    break;
                }
            }

            ((XElement)input.CurrentTrace).Add(pruleTrace);
        }
Esempio n. 5
0
 public void PhonologicalRuleNotUnapplied(IPhonologicalRule rule, int subruleIndex, Word input)
 {
     ((Trace)input.CurrentTrace).Children.Add(new Trace(TraceType.PhonologicalRuleAnalysis, rule)
     {
         SubruleIndex = subruleIndex, Input = input.DeepClone()
     });
 }
Esempio n. 6
0
 public void PhonologicalRuleNotApplied(IPhonologicalRule rule, int subruleIndex, Word input, FailureReason reason, object failureObj)
 {
     ((Trace)input.CurrentTrace).Children.Add(new Trace(TraceType.PhonologicalRuleSynthesis, rule)
     {
         SubruleIndex = subruleIndex, Input = input.DeepClone(), FailureReason = reason
     });
 }
Esempio n. 7
0
 public void PhonologicalRuleApplied(IPhonologicalRule rule, int subruleIndex, Word input, Word output)
 {
     ((Trace)output.CurrentTrace).Children.Add(new Trace(TraceType.PhonologicalRuleSynthesis, rule)
     {
         SubruleIndex = subruleIndex, Input = input, Output = output.DeepClone()
     });
 }
Esempio n. 8
0
		public void PhonologicalRuleNotApplied(IPhonologicalRule rule, int subruleIndex, Word input, FailureReason reason, object failureObj)
		{
			var pruleTrace = new XElement("PhonologicalRuleSynthesisTrace",
				CreateHCRuleElement("PhonologicalRule", rule),
				CreateWordElement("Input", input, false),
				CreateWordElement("Output", input, false));

			var rewriteRule = rule as RewriteRule;
			if (rewriteRule != null)
			{
				RewriteSubrule sr = rewriteRule.Subrules[subruleIndex];
				switch (reason)
				{
					case FailureReason.RequiredSyntacticFeatureStruct:
						pruleTrace.Add(new XElement("FailureReason", new XAttribute("type", "category"),
							new XElement("Category", (FeatureSymbol) input.SyntacticFeatureStruct.GetValue<SymbolicFeatureValue>("pos")),
							new XElement("RequiredCategories", sr.RequiredSyntacticFeatureStruct.GetValue<SymbolicFeatureValue>("pos")
								.Values.Select(pos => new XElement("Category", pos)))));
						break;

					case FailureReason.RequiredMprFeatures:
						pruleTrace.Add(CreateMprFeaturesFailureElement(true, (MprFeatureGroup) failureObj, sr.RequiredMprFeatures, input));
						break;

					case FailureReason.ExcludedMprFeatures:
						pruleTrace.Add(CreateMprFeaturesFailureElement(false, (MprFeatureGroup) failureObj, sr.ExcludedMprFeatures, input));
						break;
				}
			}

			((XElement) input.CurrentTrace).Add(pruleTrace);
		}
Esempio n. 9
0
		public void PhonologicalRuleApplied(IPhonologicalRule rule, int subruleIndex, Word input, Word output)
		{
			((XElement) output.CurrentTrace).Add(new XElement("PhonologicalRuleSynthesisTrace",
				CreateHCRuleElement("PhonologicalRule", rule),
				CreateWordElement("Input", input, false),
				CreateWordElement("Output", output, false)));
		}
Esempio n. 10
0
 public void PhonologicalRuleUnapplied(IPhonologicalRule rule, int subruleIndex, Word input, Word output)
 {
     ((Trace) output.CurrentTrace).Children.Add(new Trace(TraceType.PhonologicalRuleAnalysis, rule) {SubruleIndex = subruleIndex, Input = input, Output = output.DeepClone()});
 }
Esempio n. 11
0
 public void PhonologicalRuleNotApplied(IPhonologicalRule rule, int subruleIndex, Word input, FailureReason reason, object failureObj)
 {
     ((Trace) input.CurrentTrace).Children.Add(new Trace(TraceType.PhonologicalRuleSynthesis, rule) {SubruleIndex = subruleIndex, Input = input.DeepClone(), FailureReason = reason});
 }