Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lt 21815: Eliminate empty glosses #300

Merged
merged 3 commits into from
Jul 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/SIL.LCModel/DomainServices/AnalysisGuessServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1032,12 +1032,17 @@ private void GenerateEntryGuesses(IDictionary<IWfiWordform, EmptyWwfInfo> map)
var newAnalysis = waFactory.Create(ww, wgFactory);
newAnalysis.CategoryRA = info.Pos;
// Not all entries have senses.
if (info.Sense != null)
if (info.Sense != null && !IsEmptyMultiUnicode(info.Sense.Gloss))
{
// copy all the gloss alternatives from the sense into the word gloss.
IWfiGloss wg = newAnalysis.MeaningsOC.First();
wg.Form.MergeAlternatives(info.Sense.Gloss);
}
else
{
// Eliminate the dummy gloss (LT-21815).
newAnalysis.MeaningsOC.Clear();
}
var wmb = wmbFactory.Create();
newAnalysis.MorphBundlesOS.Add(wmb);
if (info.Form != null)
Expand All @@ -1058,6 +1063,16 @@ private void GenerateEntryGuesses(IDictionary<IWfiWordform, EmptyWwfInfo> map)
}
}
}

bool IsEmptyMultiUnicode(IMultiUnicode multiUnicode)
{
foreach (var ws in multiUnicode.AvailableWritingSystemIds)
{
if (multiUnicode.get_String(ws).Length > 0)
return false;
}
return true;
}
#endregion GenerateEntryGuesses
}
}
Loading