diff --git a/DistFiles/Language Explorer/Configuration/Words/areaConfiguration.xml b/DistFiles/Language Explorer/Configuration/Words/areaConfiguration.xml index 2626b72121..c96cd99a5e 100644 --- a/DistFiles/Language Explorer/Configuration/Words/areaConfiguration.xml +++ b/DistFiles/Language Explorer/Configuration/Words/areaConfiguration.xml @@ -15,6 +15,7 @@ + @@ -278,6 +279,7 @@ + diff --git a/Src/LexText/ParserUI/ParserListener.cs b/Src/LexText/ParserUI/ParserListener.cs index 2b8dcdb5f6..7709b9d71e 100644 --- a/Src/LexText/ParserUI/ParserListener.cs +++ b/Src/LexText/ParserUI/ParserListener.cs @@ -63,6 +63,7 @@ public class ParserListener : IxCoreColleague, IDisposable, IVwNotifyChange private TryAWordDlg m_dialog; private FormWindowState m_prevWindowState; private ParserConnection m_parserConnection; + private int m_wordCount = 0; private Timer m_timer; // Keep track of parse results as we parse wordforms. private Dictionary m_checkParserResults = null; @@ -271,6 +272,11 @@ public string ParserQueueString med = m_parserConnection.GetQueueSize(ParserPriority.Medium).ToString(); high = m_parserConnection.GetQueueSize(ParserPriority.High).ToString(); } + if (low == "0" && med == "0" && high == "0") + { + // All done. Report number of words parsed. + return string.Format(ParserUIStrings.ksParsedXWords, m_wordCount); + } return string.Format(ParserUIStrings.ksQueueXYZ, low, med, high); } @@ -504,6 +510,17 @@ public bool OnDisplayParseWordsInCurrentText(object commandObject, ref UIItemDis return true; //we handled this. } + public bool OnDisplayParseUnapprovedWordsInCurrentText(object commandObject, ref UIItemDisplayProperties display) + { + CheckDisposed(); + + bool enable = CurrentText != null; + display.Visible = enable; + display.Enabled = enable; + + return true; //we handled this. + } + public bool OnParseWordsInCurrentText(object argument) { CheckDisposed(); @@ -518,6 +535,40 @@ public bool OnParseWordsInCurrentText(object argument) return true; //we handled this. } + public bool OnParseUnapprovedWordsInCurrentText(object argument) + { + CheckDisposed(); + + if (CurrentText != null && ConnectToParser()) + { + IStText text = CurrentText; + IEnumerable wordforms = GetUnapprovedWordforms(text); + UpdateWordforms(wordforms, ParserPriority.Medium); + } + + return true; //we handled this. + } + + private IEnumerable GetUnapprovedWordforms(IStText text) + { + HashSet unapprovedWordforms = new HashSet(); + foreach (IStTxtPara para in text.ParagraphsOS) + { + foreach (ISegment seg in para.SegmentsOS) + { + foreach (IAnalysis analysis in seg.AnalysesRS) + { + if (analysis is IWfiWordform) + { + unapprovedWordforms.Add(analysis.Wordform); + } + } + } + } + return unapprovedWordforms; + + } + public bool OnCheckParserOnCurrentText(object argument) { CheckDisposed(); @@ -632,11 +683,13 @@ private void UpdateWordforms(IEnumerable wordforms, ParserPriority ShowParserReport(viewModel); } } + m_wordCount = wordforms.Count(); m_parserConnection.UpdateWordforms(wordforms, priority, checkParser); } private void UpdateWordform(IWfiWordform wordform, ParserPriority priority) { + m_wordCount = 1; m_parserConnection.UpdateWordform(wordform, priority); } diff --git a/Src/LexText/ParserUI/ParserUIStrings.Designer.cs b/Src/LexText/ParserUI/ParserUIStrings.Designer.cs index 4a4e5b67d7..802a935fc9 100644 --- a/Src/LexText/ParserUI/ParserUIStrings.Designer.cs +++ b/Src/LexText/ParserUI/ParserUIStrings.Designer.cs @@ -402,6 +402,15 @@ public static string ksNumZeroParsesToolTip { } } + /// + /// Looks up a localized string similar to Parsed {0} word(s). + /// + public static string ksParsedXWords { + get { + return ResourceManager.GetString("ksParsedXWords", resourceCulture); + } + } + /// /// Looks up a localized string similar to Parser Parameters. /// diff --git a/Src/LexText/ParserUI/ParserUIStrings.resx b/Src/LexText/ParserUI/ParserUIStrings.resx index 467bf3f801..6137d2b1e7 100644 --- a/Src/LexText/ParserUI/ParserUIStrings.resx +++ b/Src/LexText/ParserUI/ParserUIStrings.resx @@ -156,6 +156,9 @@ Queue: ({0}/{1}/{2}) {0}, {1}, and {2} are numbers (or value of ksDash) + + Parsed {0} word(s) + Undo Editing Parser Parameters