Skip to content

Commit 59e5ad7

Browse files
authored
Fix LT-22280: Yellow box when parsing a text (#459)
* Fix LT-22280: Yellow box when parsing a text * Improve error message * Clear task report message when finished * Append additional properties
1 parent c630345 commit 59e5ad7

2 files changed

Lines changed: 20 additions & 6 deletions

File tree

Src/LexText/ParserCore/XAmplePropertiesXAmpleDataFilesAugmenter.cs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ private void AddXAmplePropertiesToLexiconFile()
149149
list.Name.BestAnalysisAlternative.Text
150150
== customListName
151151
);
152-
BuildAllomorphPropertyMapper(allomorphHvoPropertyMapper, customList);
152+
BuildAllomorphPropertyMapper(allomorphHvoPropertyMapper, customList, customListName);
153153
BuildMorphemePropertyMapper(morphemePropertyMapper, customList);
154154
// Add allomorph properties
155155
var lexWithAlloProps = allomorphHvoPropertyMapper.Aggregate(
@@ -178,25 +178,37 @@ private void CreateXAmpleTempFileAndCopyBack(string xAmpleFile, string tempExten
178178

179179
private static void BuildAllomorphPropertyMapper(
180180
Dictionary<string, string> allomorphHvoPropertyMapper,
181-
ICmPossibilityList customList)
181+
ICmPossibilityList customList, string customListName)
182182
{
183183
foreach (var prop in customList.PossibilitiesOS)
184184
{
185185
var refObjs = prop.ReferringObjects.Select(o => o).Where(o => !(o is ILexEntry));
186186
foreach (ICmObject obj in refObjs)
187187
{
188188
var sHvo = obj.Hvo.ToString();
189-
if (!allomorphHvoPropertyMapper.ContainsKey(sHvo))
189+
var hvoMatch = " {" + sHvo + "}";
190+
if (!allomorphHvoPropertyMapper.ContainsKey(hvoMatch))
190191
{
191-
var hvoMatch = " {" + sHvo + "}";
192-
var replaceWith =
193-
hvoMatch + " " + prop.Name.AnalysisDefaultWritingSystem.Text;
192+
var replaceWith = hvoMatch + " " + prop.Name.AnalysisDefaultWritingSystem.Text;
194193
allomorphHvoPropertyMapper.Add(hvoMatch, replaceWith);
194+
} else
195+
{
196+
// Append the new value to the existing value.
197+
allomorphHvoPropertyMapper[hvoMatch] += " " + prop.Name.AnalysisDefaultWritingSystem.Text;
195198
}
196199
}
197200
}
198201
}
199202

203+
private static string LexEntryName(ICmObject obj)
204+
{
205+
if (obj.ClassName == "MoAffixAllomorph")
206+
{
207+
return ((IMoAffixAllomorph)obj).LongName;
208+
}
209+
return "***";
210+
}
211+
200212
private static void BuildMorphemePropertyMapper(
201213
Dictionary<string, string> morphemePropertyMapper,
202214
ICmPossibilityList customList

Src/LexText/ParserUI/ParserConnection.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ public void ParserUpdateHandlerForPolling(object sender, ParserUpdateEventArgs a
153153
{
154154
//store this for clients which just want to poll us, instead of wiring up to the event
155155
m_activity = args.Task.Description;
156+
if (args.Task.Phase == TaskReport.TaskPhase.Finished)
157+
m_activity = "";
156158
//keeps us from getting the notification at the end of the task.
157159
if (args.Task.NotificationMessage != null && args.Task.Phase != TaskReport.TaskPhase.Finished)
158160
m_notificationMessage = args.Task.NotificationMessage;

0 commit comments

Comments
 (0)