Skip to content

Commit

Permalink
Merge branch 'release/9.1' into LT-21742
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonleenaylor authored May 31, 2024
2 parents 56bb526 + 722b7f2 commit df51003
Show file tree
Hide file tree
Showing 15 changed files with 92,942 additions and 134 deletions.
5 changes: 3 additions & 2 deletions Src/LexText/ParserCore/HCLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1159,7 +1159,8 @@ private AffixProcessAllomorph LoadAffixProcessAllomorph(IMoAffixProcess allo)
IPhCode code = termUnit.CodesOS[0];
string strRep = termUnit.ClassID == PhBdryMarkerTags.kClassId ? code.Representation.BestVernacularAlternative.Text
: code.Representation.VernacularDefaultWritingSystem.Text;
strRep = strRep.Trim();
if (strRep != null)
strRep = strRep.Trim();
if (string.IsNullOrEmpty(strRep))
throw new InvalidAffixProcessException(allo, false);
sb.Append(strRep);
Expand Down Expand Up @@ -2344,7 +2345,7 @@ private void LoadCharacterDefinitionTable(IPhPhonemeSet phonemeSet)
}
}

m_null = m_table.AddBoundary(new[] {"^0", "*0", "&0", "Ø", "∅"});
m_null = m_table.AddBoundary(new[] {"^0", "*0", "&0", "∅"});
m_table.AddBoundary(".");
m_morphBdry = m_table["+"];

Expand Down
27 changes: 27 additions & 0 deletions Src/LexText/ParserCore/HCParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,33 @@ public void WriteDataIssues(XElement elem)
writer.WriteEndElement();
}
}
foreach (IPhPhoneme phone in m_cache.LangProject.PhonologicalDataOA.PhonemeSetsOS[0].PhonemesOC)
{
foreach (IPhCode code in phone.CodesOS)
{
if (code != null && code.Representation != null)
{
var grapheme = code.Representation.BestVernacularAlternative.Text;
// Check for empty graphemes/codes whcih can cause a crash; see https://jira.sil.org/browse/LT-21589
if (String.IsNullOrEmpty(grapheme) || grapheme == "***")
{
writer.WriteStartElement("EmptyGrapheme");
writer.WriteElementString("Phoneme", phone.Name.BestVernacularAnalysisAlternative.Text);
writer.WriteEndElement();
}
else
// Check for '[' and ']' which can cause a mysterious message in Try a Word
if (grapheme.Contains("[") || grapheme.Contains("]"))
{
writer.WriteStartElement("NoBracketsAsGraphemes");
writer.WriteElementString("Grapheme", grapheme);
writer.WriteElementString("Phoneme", phone.Name.BestVernacularAnalysisAlternative.Text);
writer.WriteElementString("Bracket", grapheme);
writer.WriteEndElement();
}
}
}
}
writer.WriteEndElement();
}
}
Expand Down
4 changes: 2 additions & 2 deletions Src/LexText/ParserCore/ParserCoreTests/HCLoaderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ namespace SIL.FieldWorks.WordWorks.Parser
[TestFixture]
public class HCLoaderTests : MemoryOnlyBackendProviderRestoredForEachTestTestBase
{
private const string PrefixNull = "([StrRep:{\"&0\", \"*0\", \"^0\", \"\", \"Ø\"}, Type:boundary][StrRep:\"+\", Type:boundary])*";
private const string SuffixNull = "([StrRep:\"+\", Type:boundary][StrRep:{\"&0\", \"*0\", \"^0\", \"\", \"Ø\"}, Type:boundary])*";
private const string PrefixNull = "([StrRep:{\"&0\", \"*0\", \"^0\", \"\"}, Type:boundary][StrRep:\"+\", Type:boundary])*";
private const string SuffixNull = "([StrRep:\"+\", Type:boundary][StrRep:{\"&0\", \"*0\", \"^0\", \"\"}, Type:boundary])*";
private const string AnyPlus = PrefixNull + "ANY+" + SuffixNull;
private const string AnyStar = PrefixNull + "ANY*" + SuffixNull;
private const string VowelFS = "[cons:-, Type:segment, voc:+]";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class M3ToXAmpleTransformerTests
string m_sM3FXTLatinDump;
string m_sM3FXTIrregularlyInflectedFormsDump;
string m_sM3FXTQuechuaMYLDump;
string m_sM3FXTEmiFLExDump;
private string m_sAbazaOrderClassPlayDump;
readonly Dictionary<string, XPathDocument> m_mapXmlDocs = new Dictionary<string, XPathDocument>();

Expand Down Expand Up @@ -85,6 +86,7 @@ private void SetUpM3FXTDump()
m_sM3FXTIrregularlyInflectedFormsDump = Path.Combine(m_sTestPath, "IrregularlyInflectedFormsParserFxtResult.xml");
m_sAbazaOrderClassPlayDump = Path.Combine(m_sTestPath, "Abaza-OrderclassPlay.xml");
m_sM3FXTQuechuaMYLDump = Path.Combine(m_sTestPath, "QuechuaMYLFxtResult.xml");
m_sM3FXTEmiFLExDump = Path.Combine(m_sTestPath, "emi-flexFxtResult.xml");

SetupXmlDocument(m_sM3FXTDump);
SetupXmlDocument(m_sM3FXTCircumfixDump);
Expand All @@ -102,6 +104,7 @@ private void SetUpM3FXTDump()
SetupXmlDocument(m_sM3FXTIrregularlyInflectedFormsDump);
SetupXmlDocument(m_sAbazaOrderClassPlayDump);
SetupXmlDocument(m_sM3FXTQuechuaMYLDump);
SetupXmlDocument(m_sM3FXTEmiFLExDump);
}

private void SetupXmlDocument(string filepath)
Expand Down Expand Up @@ -161,6 +164,7 @@ public void CreateXAmpleLexiconFile()
ApplyTransform(m_sM3FXTIrregularlyInflectedFormsDump, m_lexTransform, "IrregularlyInflectedFormsLexicon.txt");
ApplyTransform(m_sAbazaOrderClassPlayDump, m_lexTransform, "Abaza-OrderclassPlaylex.txt");
ApplyTransform(m_sM3FXTQuechuaMYLDump, m_lexTransform, "QuechuaMYLlex.txt");
ApplyTransform(m_sM3FXTEmiFLExDump, m_lexTransform, "emi-flexlex.txt");
}
/// <summary>
/// Test creating the word grammar file
Expand Down
Loading

0 comments on commit df51003

Please sign in to comment.