Skip to content
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 @@ -285,7 +285,7 @@
<ChorusNugetVersion>5.2.0-beta0003</ChorusNugetVersion>
<PalasoNugetVersion>15.0.0-beta0117</PalasoNugetVersion>
<ParatextNugetVersion>9.4.0.1-beta</ParatextNugetVersion>
<LcmNugetVersion>11.0.0-beta0121</LcmNugetVersion>
<LcmNugetVersion>11.0.0-beta0124</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 @@ -51,15 +51,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-beta0121" targetFramework="net461" />
<package id="SIL.LCModel.Core.Tests" version="11.0.0-beta0121" targetFramework="net461" />
<package id="SIL.LCModel.Core" version="11.0.0-beta0121" targetFramework="net461" />
<package id="SIL.LCModel.FixData" version="11.0.0-beta0121" targetFramework="net461" />
<package id="SIL.LCModel.Tests" version="11.0.0-beta0121" targetFramework="net461" />
<package id="SIL.LCModel.Tools" version="11.0.0-beta0121" targetFramework="net461" />
<package id="SIL.LCModel.Utils.Tests" version="11.0.0-beta0121" targetFramework="net461" />
<package id="SIL.LCModel.Utils" version="11.0.0-beta0121" targetFramework="net461" />
<package id="SIL.LCModel" version="11.0.0-beta0121" targetFramework="net461" />
<package id="SIL.LCModel.Build.Tasks" version="11.0.0-beta0124" targetFramework="net461" />
<package id="SIL.LCModel.Core.Tests" version="11.0.0-beta0124" targetFramework="net461" />
<package id="SIL.LCModel.Core" version="11.0.0-beta0124" targetFramework="net461" />
<package id="SIL.LCModel.FixData" version="11.0.0-beta0124" targetFramework="net461" />
<package id="SIL.LCModel.Tests" version="11.0.0-beta0124" targetFramework="net461" />
<package id="SIL.LCModel.Tools" version="11.0.0-beta0124" targetFramework="net461" />
<package id="SIL.LCModel.Utils.Tests" version="11.0.0-beta0124" targetFramework="net461" />
<package id="SIL.LCModel.Utils" version="11.0.0-beta0124" targetFramework="net461" />
<package id="SIL.LCModel" version="11.0.0-beta0124" 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
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,14 @@
<command id="CmdChooseHCParser" label="Phonological Rule-based Parser (HermitCrab.NET)" message="ChooseParser">
<parameters parser="HC"/>
</command>
<command id="CmdParsingDevelopmentMode" label="Parsing Development" message="SetParsingMode">
<parameters value="true"/>
</command>
<command id="CmdTextAnalysisMode" label="Text Analysis" message="SetParsingMode">
<parameters value="false"/>
</command>

<!-- Texts Area commands-->
<!-- Texts Area commands-->
<command id="CmdInsertText" label="New _Text" message="InsertInterlinText" shortcut="Ctrl+T" icon="addNewText">
<parameters className="StText"/>
</command>
Expand Down Expand Up @@ -286,6 +292,10 @@
<item command="CmdChooseXAmpleParser"/>
<item command="CmdChooseHCParser"/>
</menu>
<menu id="ChooseModeMenu" label="Interlinear Mode">
<item command="CmdParsingDevelopmentMode"/>
<item command="CmdTextAnalysisMode"/>
</menu>
<item command="CmdEditParserParameters"/>
</menu>
<include path="Extensions/*/AreaConfigurationExtension.xml" query="root/menubar/*"/>
Expand Down
11 changes: 9 additions & 2 deletions Src/LexText/Interlinear/ChooseAnalysisHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ public void SetupCombo()
var wordform = m_owner.GetWordformOfAnalysis();

// Add the analyses, and recursively the other items.
var guess_services = new AnalysisGuessServices(m_cache);
var guess_services = new AnalysisGuessServices(m_cache, IsParsingMode());
var sorted_analyses = guess_services.GetSortedAnalysisGuesses(wordform, m_occurrence, false);
foreach (var wa in sorted_analyses)
{
Expand Down Expand Up @@ -311,7 +311,7 @@ void AddAnalysisItems(IWfiAnalysis wa)
{
AddItem(wa,
MakeAnalysisStringRep(wa, m_cache, StyleSheet != null, (m_owner as SandboxBase).RawWordformWs), true);
var guess_services = new AnalysisGuessServices(m_cache);
var guess_services = new AnalysisGuessServices(m_cache, IsParsingMode());
var sorted_glosses = guess_services.GetSortedGlossGuesses(wa, m_occurrence);
foreach (var gloss in sorted_glosses)
{
Expand All @@ -323,6 +323,13 @@ void AddAnalysisItems(IWfiAnalysis wa)
AddItem(wa, MakeSimpleString(ITextStrings.ksNewWordGloss), false, WfiGlossTags.kClassId);
}

private bool IsParsingMode()
{
if (Owner?.InterlinDoc?.GetMaster() == null)
return false;
return Owner.InterlinDoc.GetMaster().IsParsingMode();
}

protected ITsString MakeSimpleString(String str)
{
ITsStrBldr builder = TsStringUtils.MakeStrBldr();
Expand Down
11 changes: 10 additions & 1 deletion Src/LexText/Interlinear/ITextStrings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions Src/LexText/Interlinear/ITextStrings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -986,4 +986,11 @@ Click "Cancel" to abort this import.</value>
<data name="ksConcordanceExportTitle" xml:space="preserve">
<value>Export Concordance Results</value>
</data>
<data name="ComplexConcControl_ResultsMayBeIncomplete" xml:space="preserve">
<value>Results may be incomplete.</value>
</data>
<data name="ksParsingMode" xml:space="preserve">
<value>Parsing</value>
<comment>alternate name for Analyze tab</comment>
</data>
</root>
1 change: 1 addition & 0 deletions Src/LexText/Interlinear/InterlinDocRootSiteBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,7 @@ protected virtual void SetRootInternal(int hvo)
NonUndoableUnitOfWorkHelper.Do(Cache.ActionHandlerAccessor, () =>
InterlinMaster.LoadParagraphAnnotationsAndGenerateEntryGuessesIfNeeded(RootStText, true));
// Sync Guesses data before we redraw anything.
Vc.RootSite = this;
UpdateGuessData();
}
// FWR-191: we don't need to reconstruct the display if we didn't need to reload annotations
Expand Down
45 changes: 45 additions & 0 deletions Src/LexText/Interlinear/InterlinMaster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public partial class InterlinMaster : InterlinMasterBase, IFocusablePanePortion

private string m_currentTool = "";

private string m_analyzeTabName = "";

public string CurrentTool
{
get { return m_currentTool; }
Expand Down Expand Up @@ -87,6 +89,8 @@ public InterlinMaster()
{
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();
// Save the Analyze tab name.
m_analyzeTabName = m_tpInterlinear.Text;
}

internal string BookmarkId
Expand Down Expand Up @@ -721,6 +725,7 @@ public override void Init(Mediator mediator, PropertyTable propertyTable, XmlNod
m_mediator = mediator;
// InitBase will do this, but we need it in place before calling SetInitialTabPage().
m_propertyTable = propertyTable;
SetParsingMode(IsParsingMode());

// Making the tab control currently requires this first...
if (!fHideTitlePane)
Expand Down Expand Up @@ -1246,6 +1251,46 @@ public bool OnConfigureInterlinear(object argument)
return true; // We handled this
}

public bool OnDisplaySetParsingMode(object commandObject,
ref UIItemDisplayProperties display)
{
var cmd = (Command)commandObject;
bool value = cmd.GetParameter("value") == "true";
display.Checked = IsParsingMode() == value;
return true;
}

public bool OnSetParsingMode(object argument)
{
var cmd = (Command)argument;
string value = cmd.GetParameter("value");
SetParsingMode(value == "true");
// Refresh the display.
RootStText = null;
m_idcAnalyze.ResetAnalysisCache();
Clerk.JumpToIndex(Clerk.CurrentIndex);
return true; // we handled this
}

public void SetParsingMode(bool value)
{
m_propertyTable.SetProperty("ParsingMode", value, PropertyTable.SettingsGroup.LocalSettings, false);
if (value)
{
m_tpInterlinear.Text = ITextStrings.ksParsingMode;
}
else
{
// Restore Analyze tab name.
m_tpInterlinear.Text = m_analyzeTabName;
}
}

public bool IsParsingMode()
{
return m_propertyTable.GetBoolProperty("ParsingMode", false, PropertyTable.SettingsGroup.LocalSettings);
}

/// <summary>
/// Use this to determine whether the last selected tab page which was
/// persisted in the PropertyTable, pertains to an interlinear document.
Expand Down
70 changes: 44 additions & 26 deletions Src/LexText/Interlinear/InterlinVc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -373,17 +373,24 @@ public void ResetAnalysisCache()
if (m_loader != null)
{
CheckDisposed();
m_loader.ResetGuessCache();
m_loader.ResetGuessCache(IsParsingMode());
}
}

internal bool IsParsingMode()
{
if (RootSite?.GetMaster() == null)
return false;
return RootSite.GetMaster().IsParsingMode();
}

internal AnalysisGuessServices GuessServices
{
get
{
if (m_loader != null && m_loader.GuessServices != null)
return m_loader.GuessServices;
return new AnalysisGuessServices(m_cache);
return new AnalysisGuessServices(m_cache, IsParsingMode());
}
}

Expand Down Expand Up @@ -541,10 +548,32 @@ private void SetGuessing(IVwEnv vwenv, int bgColor)
UsingGuess = true;
}

private void SetGuessing(IVwEnv vwenv)
private int GetGuessColor(ICmObject obj)
{
SetGuessing(vwenv, ApprovedGuessColor);
UsingGuess = true;
IWfiAnalysis wa;
if (IsParsingMode())
{
// Parser approval takes precedence over User approval.
wa = (obj is IWfiGloss) ? ((IWfiGloss)obj).Analysis : obj as IWfiAnalysis;
if (wa != null)
{
Opinions opinion = wa.GetAgentOpinion(wa.Cache.LangProject.DefaultParserAgent);
if (opinion == Opinions.approves)
return MachineGuessColor;
}
return ApprovedGuessColor;
}
// User approval takes precedence over Parser approval.
if (obj is IWfiGloss)
return ApprovedGuessColor;
wa = obj as IWfiAnalysis;
if (wa != null)
{
Opinions opinion = wa.GetAgentOpinion(wa.Cache.LangProject.DefaultUserAgent);
if (opinion == Opinions.approves)
return ApprovedGuessColor;
}
return MachineGuessColor;
}

public bool UsingGuess { get; set; }
Expand Down Expand Up @@ -1822,11 +1851,7 @@ private void DisplayMorphemes()
// Display the morpheme bundles.
if (m_hvoDefault != m_hvoWordBundleAnalysis)
{
// Real analysis isn't what we're displaying, so morph breakdown
// is a guess. Is it a human-approved guess?
bool isHumanGuess = m_this.GuessCache.get_IntProp(m_hvoDefault, InterlinViewDataCache.OpinionAgentFlid) !=
(int) AnalysisGuessServices.OpinionAgent.Parser;
m_this.SetGuessing(m_vwenv, isHumanGuess ? ApprovedGuessColor : MachineGuessColor);
m_this.SetGuessing(m_vwenv, m_this.GetGuessColor(m_defaultObj));
// Let the exporter know that this is a guessed analysis.
m_vwenv.set_StringProperty(ktagAnalysisStatus, "guess");
}
Expand All @@ -1842,7 +1867,7 @@ private void DisplayMorphemes()
if (m_hvoWordBundleAnalysis == m_hvoWordform)
{
// Real analysis is just word, one we're displaying is a default
m_this.SetGuessing(m_vwenv);
m_this.SetGuessing(m_vwenv, m_this.GetGuessColor(m_defaultObj));
// Let the exporter know that this is a guessed analysis.
m_vwenv.set_StringProperty(ktagAnalysisStatus, "guess");
}
Expand All @@ -1866,11 +1891,7 @@ private void DisplayWordGloss(InterlinLineSpec spec, int choiceIndex)
case WfiAnalysisTags.kClassId:
if (m_hvoDefault != m_hvoWordBundleAnalysis)
{
// Real analysis isn't what we're displaying, so morph breakdown
// is a guess. Is it a human-approved guess?
bool isHumanGuess = m_this.GuessCache.get_IntProp(m_hvoDefault, InterlinViewDataCache.OpinionAgentFlid) !=
(int)AnalysisGuessServices.OpinionAgent.Parser;
m_this.SetGuessing(m_vwenv, isHumanGuess ? ApprovedGuessColor : MachineGuessColor);
m_this.SetGuessing(m_vwenv, m_this.GetGuessColor(m_defaultObj));
}
var wa = (IWfiAnalysis) m_defaultObj;
if (wa.MeaningsOC.Count == 0)
Expand Down Expand Up @@ -1899,7 +1920,7 @@ private void DisplayWordGloss(InterlinLineSpec spec, int choiceIndex)
}
else
{
m_this.SetGuessing(m_vwenv);
m_this.SetGuessing(m_vwenv, m_this.GetGuessColor(m_defaultObj));
m_vwenv.AddObj(m_hvoDefault, m_this, kfragLineChoices + choiceIndex);
}
break;
Expand All @@ -1919,18 +1940,14 @@ private void DisplayWordPOS(int choiceIndex)
case WfiAnalysisTags.kClassId:
if (m_hvoDefault != m_hvoWordBundleAnalysis)
{
// Real analysis isn't what we're displaying, so POS is a guess.
bool isHumanApproved = m_this.GuessCache.get_IntProp(m_hvoDefault, InterlinViewDataCache.OpinionAgentFlid)
!= (int)AnalysisGuessServices.OpinionAgent.Parser;

m_this.SetGuessing(m_vwenv, isHumanApproved ? ApprovedGuessColor : MachineGuessColor);
m_this.SetGuessing(m_vwenv, m_this.GetGuessColor(m_defaultObj));
}
m_this.AddAnalysisPos(m_vwenv, m_hvoDefault, m_hvoWordBundleAnalysis, choiceIndex);
break;
case WfiGlossTags.kClassId:
m_hvoWfiAnalysis = m_defaultObj.Owner.Hvo;
if (m_hvoWordBundleAnalysis == m_hvoWordform) // then our analysis is a guess
m_this.SetGuessing(m_vwenv);
m_this.SetGuessing(m_vwenv, m_this.GetGuessColor(m_defaultObj));
m_vwenv.AddObj(m_hvoWfiAnalysis, m_this, kfragAnalysisCategoryChoices + choiceIndex);
break;
default:
Expand Down Expand Up @@ -2288,7 +2305,7 @@ private void EnsureLoader()

internal virtual IParaDataLoader CreateParaLoader()
{
return new InterlinViewCacheLoader(new AnalysisGuessServices(m_cache), GuessCache);
return new InterlinViewCacheLoader(new AnalysisGuessServices(m_cache, IsParsingMode()), GuessCache);
}

internal void RecordGuessIfNotKnown(AnalysisOccurrence selected)
Expand Down Expand Up @@ -2409,7 +2426,7 @@ public interface IParaDataLoader
{
void LoadParaData(IStTxtPara para);
void LoadSegmentData(ISegment seg);
void ResetGuessCache();
void ResetGuessCache(bool parsingMode);
bool UpdatingOccurrence(IAnalysis oldAnalysis, IAnalysis newAnalysis);
void RecordGuessIfNotKnown(AnalysisOccurrence occurrence);
IAnalysis GetGuessForWordform(IWfiWordform wf, int ws);
Expand Down Expand Up @@ -2533,10 +2550,11 @@ protected virtual void SetInt(int hvo, int flid, int n)
#region IParaDataLoader Members


public void ResetGuessCache()
public void ResetGuessCache(bool parsingMode)
{
// recreate the guess services, so they will use the latest FDO data.
GuessServices.ClearGuessData();
GuessServices.PrioritizeParser = parsingMode;
// clear the cache for the guesses, so it won't have any stale data.
m_guessCache.ClearPropFromCache(InterlinViewDataCache.AnalysisMostApprovedFlid);
}
Expand Down
Loading
Loading