diff --git a/Build/SilVersions.props b/Build/SilVersions.props
index b90cd986fc..0ea3730ac4 100644
--- a/Build/SilVersions.props
+++ b/Build/SilVersions.props
@@ -17,7 +17,7 @@
18.0.0-beta0012
6.0.0-beta0065
3.0.1
- 3.8.2
+ 3.9.2
1.1.1-beta0001
10.0.0-beta0004
0.9.8
diff --git a/Src/LexText/ParserCore/HCParser.cs b/Src/LexText/ParserCore/HCParser.cs
index 37015bb53b..dd09d1c9ea 100644
--- a/Src/LexText/ParserCore/HCParser.cs
+++ b/Src/LexText/ParserCore/HCParser.cs
@@ -15,6 +15,7 @@
using SIL.Machine.Annotations;
using SIL.Machine.Morphology.HermitCrab;
using SIL.Machine.Morphology.HermitCrab.MorphologicalRules;
+using SIL.Machine.Rules;
using SIL.ObjectModel;
namespace SIL.FieldWorks.WordWorks.Parser
@@ -149,6 +150,7 @@ private void LoadParser()
// For Hermit Crab, the maximum number of roots/stems allowed is between one and ten.
// The default is two in order to allow for compounding (which requires there be at least two roots/stems).
int maxStemCount = 2;
+ int maxAlternatives = 0;
string loadErrorsFile = Path.Combine(m_outputDirectory, m_cache.ProjectId.Name + "HCLoadErrors.xml");
using (XmlWriter writer = XmlWriter.Create(loadErrorsFile))
using (new WorkerThreadReadHelper(m_cache.ServiceLocator.GetInstance()))
@@ -161,6 +163,7 @@ private void LoadParser()
XElement guessRootsElem = parserParamsElem.Elements("HC").Elements("GuessRoots").FirstOrDefault();
XElement mergeAnalysesElem = parserParamsElem.Elements("HC").Elements("MergeAnalyses").FirstOrDefault();
XElement maxRootsElem = parserParamsElem.Elements("HC").Elements("MaxRoots").FirstOrDefault();
+ XElement maxAlternativesElem = parserParamsElem.Elements("HC").Elements("MaxAlternatives").FirstOrDefault();
if (delReappsElem != null)
delReapps = (int) delReappsElem;
if (guessRootsElem != null)
@@ -169,10 +172,13 @@ private void LoadParser()
m_mergeAnalyses = (bool) mergeAnalysesElem;
if (maxRootsElem != null)
maxStemCount = int.Parse(maxRootsElem.Value);
+ if (maxAlternativesElem != null)
+ maxAlternatives = int.Parse(maxAlternativesElem.Value);
}
m_morpher = new Morpher(m_traceManager, m_language) { DeletionReapplications = delReapps };
m_morpher.MaxStemCount = maxStemCount;
m_morpher.MergeEquivalentAnalyses = m_mergeAnalyses;
+ m_morpher.MaxAlternatives = maxAlternatives;
}
private XDocument ParseToXml(string form, bool tracing, IEnumerable selectTraceMorphs)
@@ -577,6 +583,10 @@ private string ProcessParseException(Exception e)
}
return string.Format(ParserCoreStrings.ksHCInvalidWordform, ise.String, ise.Position + 1, rest, phonemesFoundSoFar);
}
+ if (e is MaxAlternativesExceededException)
+ {
+ return ParserCoreStrings.ksMaxAlternativesExceeded;
+ }
return String.Format(ParserCoreStrings.ksHCDefaultErrorMsg, e.Message);
}
diff --git a/Src/LexText/ParserCore/ParserCore.csproj b/Src/LexText/ParserCore/ParserCore.csproj
index 57aa7317f3..d466865d31 100644
--- a/Src/LexText/ParserCore/ParserCore.csproj
+++ b/Src/LexText/ParserCore/ParserCore.csproj
@@ -1,4 +1,4 @@
-
+
ParserCore
@@ -54,4 +54,17 @@
Properties\CommonAssemblyInfo.cs
+
+
+ True
+ True
+ ParserCoreStrings.resx
+
+
+
+
+ ResXFileCodeGenerator
+ ParserCoreStrings.Designer.cs
+
+
\ No newline at end of file
diff --git a/Src/LexText/ParserCore/ParserCoreStrings.Designer.cs b/Src/LexText/ParserCore/ParserCoreStrings.Designer.cs
index e1fd20fee7..a7a978cc09 100644
--- a/Src/LexText/ParserCore/ParserCoreStrings.Designer.cs
+++ b/Src/LexText/ParserCore/ParserCoreStrings.Designer.cs
@@ -1,4 +1,4 @@
-//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
@@ -19,7 +19,7 @@ namespace SIL.FieldWorks.WordWorks.Parser {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "18.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class ParserCoreStrings {
@@ -132,6 +132,15 @@ internal static string ksIrregularlyInflectedFormNullAffix {
}
}
+ ///
+ /// Looks up a localized string similar to MaxAlternatives exceeded.
+ ///
+ internal static string ksMaxAlternativesExceeded {
+ get {
+ return ResourceManager.GetString("ksMaxAlternativesExceeded", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Parsing {0}.
///
diff --git a/Src/LexText/ParserCore/ParserCoreStrings.resx b/Src/LexText/ParserCore/ParserCoreStrings.resx
index 7ae94aa3a4..c9ea372263 100644
--- a/Src/LexText/ParserCore/ParserCoreStrings.resx
+++ b/Src/LexText/ParserCore/ParserCoreStrings.resx
@@ -189,4 +189,7 @@
Parsing {0}
+
+ MaxAlternatives exceeded
+
\ No newline at end of file
diff --git a/Src/LexText/ParserUI/ParserParametersDlg.cs b/Src/LexText/ParserUI/ParserParametersDlg.cs
index 0c6bd9f8ba..5729da0ca0 100644
--- a/Src/LexText/ParserUI/ParserParametersDlg.cs
+++ b/Src/LexText/ParserUI/ParserParametersDlg.cs
@@ -43,6 +43,7 @@ public class ParserParametersDlg : ParserParametersBase
private const string MaxInfixes = "MaxInfixes";
private const string MaxInterfixes = "MaxInterfixes";
private const string MaxRoots = "MaxRoots";
+ private const string MaxAlternatives = "MaxAlternatives";
private const string MaxAnalysesToReturn = "MaxAnalysesToReturn";
#region Data members
@@ -233,6 +234,7 @@ private void ValidateValues(XElement elem)
// For Hermit Crab, the maximum number of roots/stems allowed is between one and ten.
// The default is two in order to allow for compounding (which requires there be at least two roots/stems).
EnforceValidValue(elem, HC, MaxRoots, 1, 10, false);
+ EnforceValidValue(elem, HC, MaxAlternatives, 0, 1000000000, false);
}
private void EnforceValidValue(XElement elem, string parser, string item, int min, int max, bool useMinIfZero)
@@ -280,7 +282,8 @@ public void SetDlgInfo(string title, string parserParameters, ILcmOwningSequence
m_dataGrid2.TableStyles[0].GridColumnStyles[2].Width = 130;
m_dataGrid2.TableStyles[0].GridColumnStyles[4].Width = 160;
m_dataGrid2.TableStyles[0].GridColumnStyles[6].Width = 90;
- m_dataGrid2.TableStyles[0].GridColumnStyles[7].Width = 400;
+ m_dataGrid2.TableStyles[0].GridColumnStyles[7].Width = 100;
+ m_dataGrid2.TableStyles[0].GridColumnStyles[8].Width = 400;
m_compoundRules = compoundRules;
if (m_compoundRules?.Count > 0)
@@ -305,6 +308,8 @@ private void LoadParserData(DataSet dsParserParameters)
hcElem.Add(new XElement(NoDefaultCompounding, false));
if (hcElem.Element(MaxRoots) == null)
hcElem.Add(new XElement(MaxRoots, 2));
+ if (hcElem.Element(MaxAlternatives) == null)
+ hcElem.Add(new XElement(MaxAlternatives, 0));
if (hcElem.Element(NotOnClitics) == null)
hcElem.Add(new XElement(NotOnClitics, true));
if (hcElem.Element(AcceptUnspecifiedGraphemes) == null)
@@ -367,6 +372,7 @@ private DataTable CreateHCDataTable()
tblHC.Columns.Add(AcceptUnspecifiedGraphemes, typeof(bool));
tblHC.Columns.Add(GuessRoots, typeof(bool));
tblHC.Columns.Add(MergeAnalyses, typeof(bool));
+ tblHC.Columns.Add(MaxAlternatives, typeof(int));
tblHC.Columns.Add(Strata, typeof(string));
return tblHC;
}
diff --git a/Src/LexText/ParserUI/ParserParametersDlg.resx b/Src/LexText/ParserUI/ParserParametersDlg.resx
index 9fdd32fe9d..e86f3e3f54 100644
--- a/Src/LexText/ParserUI/ParserParametersDlg.resx
+++ b/Src/LexText/ParserUI/ParserParametersDlg.resx
@@ -252,7 +252,7 @@
8, 64
- 576, 72
+ 546, 72
6
@@ -300,7 +300,7 @@
8, 165
- 976, 100
+ 1076, 100
8
@@ -351,7 +351,7 @@
5, 13
- 1000, 388
+ 1100, 388