From 02cd0bf2825df2ecc2570134a1657dd699cf5c34 Mon Sep 17 00:00:00 2001 From: John Maxwell Date: Tue, 5 Aug 2025 09:05:27 -0700 Subject: [PATCH 1/2] Fix LT-22204: Phonological rule output not written correctly --- Src/LexText/ParserCore/FwXmlTraceManager.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Src/LexText/ParserCore/FwXmlTraceManager.cs b/Src/LexText/ParserCore/FwXmlTraceManager.cs index ef3466f07c..72e89fc921 100644 --- a/Src/LexText/ParserCore/FwXmlTraceManager.cs +++ b/Src/LexText/ParserCore/FwXmlTraceManager.cs @@ -407,11 +407,12 @@ private static XElement CreateWordElement(string name, Word word, bool analysis, private static string ToBracketedString(IEnumerable nodes, CharacterDefinitionTable table) { + // This should be in defined as Shape.ToBrackedString in HermitCrab. StringBuilder stringBuilder = new StringBuilder(); foreach (ShapeNode node in nodes) { string text = table.GetMatchingStrReps(node).FirstOrDefault(); - if (text != null) + if (text != null && !IsDeleted(node)) { if (text.Length > 1) text = "(" + text + ")"; @@ -422,6 +423,18 @@ private static string ToBracketedString(IEnumerable nodes, CharacterD return stringBuilder.ToString(); } + private static bool IsDeleted(ShapeNode node) + { + // ShapeNode.IsDeleted is copied here since it is inaccessible from FieldWorks. + Annotation ann = node.Annotation; + if (ann.FeatureStruct.TryGetValue(HCFeatureSystem.Deletion, out var value)) + { + return (FeatureSymbol)value == HCFeatureSystem.Deleted; + } + + return false; + } + private XElement CreateMorphemeElement(Morpheme morpheme) { var msaID = (int?) morpheme.Properties[HCParser.MsaID] ?? 0; From 143c26194d17eb2ce1e645ae472618782772e7f2 Mon Sep 17 00:00:00 2001 From: John Maxwell Date: Tue, 5 Aug 2025 09:19:38 -0700 Subject: [PATCH 2/2] Fix typo --- Src/LexText/ParserCore/FwXmlTraceManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Src/LexText/ParserCore/FwXmlTraceManager.cs b/Src/LexText/ParserCore/FwXmlTraceManager.cs index 72e89fc921..a0ebf5478c 100644 --- a/Src/LexText/ParserCore/FwXmlTraceManager.cs +++ b/Src/LexText/ParserCore/FwXmlTraceManager.cs @@ -407,7 +407,7 @@ private static XElement CreateWordElement(string name, Word word, bool analysis, private static string ToBracketedString(IEnumerable nodes, CharacterDefinitionTable table) { - // This should be in defined as Shape.ToBrackedString in HermitCrab. + // This should be in defined as Shape.ToBracketedString in HermitCrab. StringBuilder stringBuilder = new StringBuilder(); foreach (ShapeNode node in nodes) {