Skip to content
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
19 changes: 14 additions & 5 deletions Src/LexText/Interlinear/SandboxBase.GetRealyAnalysisMethod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -937,15 +937,15 @@ public IWfiAnalysis FindMatchingAnalysis(bool fExactMatch)
{
if (fExactMatch)
{
if (CheckAnalysis(possibleAnalysis.Hvo, true))
if (CheckAnalysis(possibleAnalysis, true))
return possibleAnalysis;
}
else
{
// If this possibility is Human evaluated, it must match exactly regardless
// of the input parameter to count as a match on the analysis.
bool fIsHumanApproved = SandboxBase.IsAnalysisHumanApproved(m_caches.MainCache, possibleAnalysis);
if (CheckAnalysis(possibleAnalysis.Hvo, fIsHumanApproved))
if (CheckAnalysis(possibleAnalysis, fIsHumanApproved))
return possibleAnalysis;
}
}
Expand Down Expand Up @@ -1012,15 +1012,16 @@ private bool IsTrivialAnalysis(IWfiAnalysis possibleAnalysis)
/// Evaluate the given possible analysis to see whether it matches the current Sandbox data.
/// Review: This is not testing word gloss at all. Is this right?
/// </summary>
/// <param name="hvoPossibleAnalysis"></param>
/// <param name="possibleAnalysis"></param>
/// <param name="fExactMatch"></param>
/// <returns></returns>
private bool CheckAnalysis(int hvoPossibleAnalysis, bool fExactMatch)
private bool CheckAnalysis(IWfiAnalysis possibleAnalysis, bool fExactMatch)
{
// First, check that the analysis has the right word category.
int hvoPossibleAnalysis = possibleAnalysis.Hvo;
int hvoWordCat = m_sdaMain.get_ObjectProp(hvoPossibleAnalysis,
WfiAnalysisTags.kflidCategory);
bool fCheck = fExactMatch || hvoWordCat != 0;
bool fCheck = hvoWordCat != 0;
if (fCheck && m_hvoCategoryReal != hvoWordCat)
{
return false;
Expand Down Expand Up @@ -1083,6 +1084,14 @@ private bool CheckAnalysis(int hvoPossibleAnalysis, bool fExactMatch)
return false;
}
}
if (fExactMatch && hvoWordCat == 0 && m_hvoCategoryReal != 0)
{
// possibleAnalysis matches except that its category is empty.
// Make the match exact by setting the category.
// This fixes LT-22237.
IPartOfSpeechRepository posRepository = m_caches.MainCache.ServiceLocator.GetInstance<IPartOfSpeechRepository>();
possibleAnalysis.CategoryRA = posRepository.GetObject(m_hvoCategoryReal);
}
return true;
}

Expand Down
Loading