Skip to content

Commit 0dabd60

Browse files
authored
Fix LT-22204: Phonological rule output not written correctly (#429)
* Fix LT-22204: Phonological rule output not written correctly * Fix typo
1 parent c7509d3 commit 0dabd60

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

Src/LexText/ParserCore/FwXmlTraceManager.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,11 +407,12 @@ private static XElement CreateWordElement(string name, Word word, bool analysis,
407407

408408
private static string ToBracketedString(IEnumerable<ShapeNode> nodes, CharacterDefinitionTable table)
409409
{
410+
// This should be in defined as Shape.ToBracketedString in HermitCrab.
410411
StringBuilder stringBuilder = new StringBuilder();
411412
foreach (ShapeNode node in nodes)
412413
{
413414
string text = table.GetMatchingStrReps(node).FirstOrDefault();
414-
if (text != null)
415+
if (text != null && !IsDeleted(node))
415416
{
416417
if (text.Length > 1)
417418
text = "(" + text + ")";
@@ -422,6 +423,18 @@ private static string ToBracketedString(IEnumerable<ShapeNode> nodes, CharacterD
422423
return stringBuilder.ToString();
423424
}
424425

426+
private static bool IsDeleted(ShapeNode node)
427+
{
428+
// ShapeNode.IsDeleted is copied here since it is inaccessible from FieldWorks.
429+
Annotation<ShapeNode> ann = node.Annotation;
430+
if (ann.FeatureStruct.TryGetValue<SymbolicFeatureValue>(HCFeatureSystem.Deletion, out var value))
431+
{
432+
return (FeatureSymbol)value == HCFeatureSystem.Deleted;
433+
}
434+
435+
return false;
436+
}
437+
425438
private XElement CreateMorphemeElement(Morpheme morpheme)
426439
{
427440
var msaID = (int?) morpheme.Properties[HCParser.MsaID] ?? 0;

0 commit comments

Comments
 (0)