Skip to content

Fixes LT-22241: User disapproved analyses in Parsing Dev Mode #433

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

Merged
merged 1 commit into from
Aug 7, 2025
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Build/mkall.targets
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@
<ChorusNugetVersion>5.2.0-beta0003</ChorusNugetVersion>
<PalasoNugetVersion>15.0.0-beta0117</PalasoNugetVersion>
<ParatextNugetVersion>9.4.0.1-beta</ParatextNugetVersion>
<LcmNugetVersion>11.0.0-beta0129</LcmNugetVersion>
<LcmNugetVersion>11.0.0-beta0130</LcmNugetVersion>
<IcuNugetVersion>70.1.123</IcuNugetVersion>
<HermitCrabNugetVersion>3.6.6</HermitCrabNugetVersion>
<IPCFrameworkVersion>1.1.1-beta0001</IPCFrameworkVersion>
Expand Down
18 changes: 9 additions & 9 deletions Build/nuget-common/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@
<package id="SIL.Core" version="8.1.0-beta0035" targetFramework="net461" />
<package id="SIL.DesktopAnalytics" version="4.0.0" targetFramework="net461" />
<package id="SIL.FLExBridge.IPCFramework" version="1.1.1-beta0001" targetFramework="net461" />
<package id="SIL.LCModel.Build.Tasks" version="11.0.0-beta0129" targetFramework="net461" />
<package id="SIL.LCModel.Core.Tests" version="11.0.0-beta0129" targetFramework="net461" />
<package id="SIL.LCModel.Core" version="11.0.0-beta0129" targetFramework="net461" />
<package id="SIL.LCModel.FixData" version="11.0.0-beta0129" targetFramework="net461" />
<package id="SIL.LCModel.Tests" version="11.0.0-beta0129" targetFramework="net461" />
<package id="SIL.LCModel.Tools" version="11.0.0-beta0129" targetFramework="net461" />
<package id="SIL.LCModel.Utils.Tests" version="11.0.0-beta0129" targetFramework="net461" />
<package id="SIL.LCModel.Utils" version="11.0.0-beta0129" targetFramework="net461" />
<package id="SIL.LCModel" version="11.0.0-beta0129" targetFramework="net461" />
<package id="SIL.LCModel.Build.Tasks" version="11.0.0-beta0130" targetFramework="net461" />
<package id="SIL.LCModel.Core.Tests" version="11.0.0-beta0130" targetFramework="net461" />
<package id="SIL.LCModel.Core" version="11.0.0-beta0130" targetFramework="net461" />
<package id="SIL.LCModel.FixData" version="11.0.0-beta0130" targetFramework="net461" />
<package id="SIL.LCModel.Tests" version="11.0.0-beta0130" targetFramework="net461" />
<package id="SIL.LCModel.Tools" version="11.0.0-beta0130" targetFramework="net461" />
<package id="SIL.LCModel.Utils.Tests" version="11.0.0-beta0130" targetFramework="net461" />
<package id="SIL.LCModel.Utils" version="11.0.0-beta0130" targetFramework="net461" />
<package id="SIL.LCModel" version="11.0.0-beta0130" targetFramework="net461" />
<package id="SIL.Lexicon" version="15.0.0-beta0117" targetFramework="net462" />
<package id="SIL.libpalaso.l10ns" version="6.0.0" targetFramework="net461" />
<package id="SIL.Lift" version="15.0.0-beta0117" targetFramework="net462" />
Expand Down
4 changes: 2 additions & 2 deletions Src/LexText/Interlinear/ChooseAnalysisHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@ public void SetupCombo()
{
Opinions o = wa.GetAgentOpinion(
m_cache.LangProject.DefaultUserAgent);
// skip any analysis the user has disapproved.
if (o != Opinions.disapproves)
// skip any analysis the user has disapproved unless we are in parsing dev mode.
if (IsParsingDevMode() || o != Opinions.disapproves)
{
AddAnalysisItems(wa);
AddSeparatorLine();
Expand Down
9 changes: 8 additions & 1 deletion Src/LexText/Interlinear/FocusBoxController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ private void ChangeOrCreateSandbox(AnalysisOccurrence selected)
//if this sandbox is presenting a wordform with multiple possible analyses then set the
//bg color indicator
if (selected.Analysis.Wordform != null &&
SandboxBase.GetHasMultipleRelevantAnalyses(selected.Analysis.Wordform))
SandboxBase.GetHasMultipleRelevantAnalyses(selected.Analysis.Wordform, IsParsingDevMode()))
{
color = InterlinVc.MultipleApprovedGuessColor;
}
Expand All @@ -154,6 +154,13 @@ private void ChangeOrCreateSandbox(AnalysisOccurrence selected)
SetSandboxSize();
}

internal bool IsParsingDevMode()
{
if (InterlinDoc?.GetMaster() == null)
return false;
return InterlinDoc.GetMaster().IsParsingDevMode();
}

internal virtual IAnalysisControlInternal CreateNewSandbox(AnalysisOccurrence selected)
{
Sandbox sandbox = new Sandbox(selected.Analysis.Cache, m_mediator, m_propertyTable, m_stylesheet,
Expand Down
2 changes: 1 addition & 1 deletion Src/LexText/Interlinear/InterlinVc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1832,7 +1832,7 @@ private void DisplayWord(int choiceIndex, IAnalysis wag)
if (word != null)
{
//test if there are multiple analyses that a user might choose from
if (SandboxBase.GetHasMultipleRelevantAnalyses(word))
if (SandboxBase.GetHasMultipleRelevantAnalyses(word, m_this.IsParsingDevMode()))
{
m_this.SetGuessing(m_vwenv, MultipleApprovedGuessColor); //There are multiple options, set the color
}
Expand Down
10 changes: 3 additions & 7 deletions Src/LexText/Interlinear/SandboxBase.ComboHandlers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,9 @@ internal InterlinComboHandler(SandboxBase sandbox)

internal bool IsParsingDevMode()
{
if (m_sandbox.InterlinDoc?.GetMaster() == null)
return false;
return m_sandbox.InterlinDoc.GetMaster().IsParsingDevMode();
return m_sandbox.IsParsingDevMode();
}



// only for testing
internal void SetSandboxForTesting(SandboxBase sandbox)
{
Expand Down Expand Up @@ -1032,8 +1028,8 @@ private void AddAnalysesOf(IWfiWordform wordform, bool fBaseWordIsPhrase)
{
Opinions o = wa.GetAgentOpinion(
m_caches.MainCache.LangProject.DefaultUserAgent);
if (o == Opinions.disapproves)
continue; // skip any analysis the user has disapproved.
if (o == Opinions.disapproves && !IsParsingDevMode())
continue; // skip any analysis the user has disapproved unless we are in parsing dev mode.
int cmorphs = wa.MorphBundlesOS.Count;
if (cmorphs == 0)
continue;
Expand Down
17 changes: 13 additions & 4 deletions Src/LexText/Interlinear/SandboxBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1211,7 +1211,7 @@ private bool LoadRealDataIntoSec1(int hvoSbWord, bool fLookForDefaults, bool fAd
if ((m_occurrenceSelected == null ||
m_occurrenceSelected.Analysis == null ||
m_occurrenceSelected.Analysis.Wordform != null) &&
GetHasMultipleRelevantAnalyses(CurrentAnalysisTree.Wordform))
GetHasMultipleRelevantAnalyses(CurrentAnalysisTree.Wordform, IsParsingDevMode()))
{
MultipleAnalysisColor = InterlinVc.MultipleApprovedGuessColor;
}
Expand Down Expand Up @@ -1633,10 +1633,12 @@ public static bool IsLexicalPattern(IMultiUnicode multiString)
return false;
}

public static bool GetHasMultipleRelevantAnalyses(IWfiWordform analysis)
public static bool GetHasMultipleRelevantAnalyses(IWfiWordform wordform, bool isParsingDevMode)
{
int humanCount = analysis.HumanApprovedAnalyses.Count();
int machineCount = analysis.HumanNoOpinionParses.Count();
if (isParsingDevMode)
return wordform.AnalysesOC.Count > 1;
int humanCount = wordform.HumanApprovedAnalyses.Count();
int machineCount = wordform.HumanNoOpinionParses.Count();
return humanCount + machineCount > 1;
}

Expand All @@ -1649,6 +1651,13 @@ private static bool IsAnalysisHumanApproved(LcmCache cache, IWfiAnalysis analysi
select ae).FirstOrDefault() != null;
}

internal bool IsParsingDevMode()
{
if (InterlinDoc?.GetMaster() == null)
return false;
return InterlinDoc.GetMaster().IsParsingDevMode();
}

/// <summary>
/// Select the indicated icon of the word.
/// </summary>
Expand Down
Loading