Skip to content

Commit

Permalink
Merge branch 'release/9.1' into LT-21620
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonleenaylor authored May 31, 2024
2 parents d9fc3f9 + 60c3fa6 commit 66b963a
Show file tree
Hide file tree
Showing 14 changed files with 92,939 additions and 131 deletions.
3 changes: 2 additions & 1 deletion 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
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
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 66b963a

Please sign in to comment.