Skip to content

Commit

Permalink
Merge branch 'release/9.1' into LT-21702
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonleenaylor authored Jun 10, 2024
2 parents 157e23e + 4962c35 commit 18ed156
Show file tree
Hide file tree
Showing 25 changed files with 3,846 additions and 86 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,14 @@ Main template
</xsl:if>
</xsl:for-each>
</languages>
<types> </types>
<types>
<type id="tDependent" color="#0000FF"/>
<type id="tGramInfo" color="#FF9900"/>
<type id="tMoved" color="#FF0000"/>
<type id="tMovedMkr" color="#FF8080"/>
<type id="tSong" color="#993366"/>
<type id="tSpeech" color="#008000"/>
</types>
</lingPaper>
</xsl:template>
<!--
Expand Down Expand Up @@ -122,7 +129,10 @@ Main template
-->
<xsl:template match="listRef">
<gloss lang="{@lang}">
<xsl:apply-templates/>
<xsl:text>&#x20;</xsl:text>
<object type="tGramInfo">
<xsl:apply-templates/>
</object>
</gloss>
</xsl:template>
<!--
Expand All @@ -132,7 +142,38 @@ Main template
<xsl:if test="@noSpaceBefore='false'">
<xsl:text>&#x20;</xsl:text>
</xsl:if>
<xsl:apply-templates/>
<xsl:choose>
<xsl:when test="ancestor::row[@type='speech']">
<object type="tSpeech">
<xsl:apply-templates/>
</object>
</xsl:when>
<xsl:when test="ancestor::row[@type='song']">
<object type="tSong">
<xsl:apply-templates/>
</object>
</xsl:when>
<xsl:when test="ancestor::row[@type='dependent']">
<object type="tDependent">
<xsl:apply-templates/>
</object>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="@noSpaceAfter='false'">
<xsl:text>&#x20;</xsl:text>
</xsl:if>
</xsl:template>

<xsl:template match="lit[following-sibling::*[1][name()='listRef'] or preceding-sibling::*[1][name()='listRef']]">
<xsl:if test="@noSpaceBefore='false' or preceding-sibling::*[1][name()='word']">
<xsl:text>&#x20;</xsl:text>
</xsl:if>
<object type="tGramInfo">
<xsl:apply-templates/>
</object>
<xsl:if test="@noSpaceAfter='false'">
<xsl:text>&#x20;</xsl:text>
</xsl:if>
Expand All @@ -143,7 +184,26 @@ Main template
<xsl:if test="count(preceding-sibling::*) &gt; 0">
<xsl:text>&#x20;</xsl:text>
</xsl:if>
<xsl:apply-templates/>
<xsl:choose>
<xsl:when test="ancestor::row[@type='speech']">
<object type="tSpeech">
<xsl:apply-templates/>
</object>
</xsl:when>
<xsl:when test="ancestor::row[@type='song']">
<object type="tSong">
<xsl:apply-templates/>
</object>
</xsl:when>
<xsl:when test="ancestor::row[@type='dependent']">
<object type="tDependent">
<xsl:apply-templates/>
</object>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</langData>
</xsl:template>

Expand All @@ -162,7 +222,7 @@ Main template
<lineGroup>
<line>
<wrd>
<xsl:apply-templates select="lit | word | listRef"/>
<xsl:apply-templates select="lit | word | listRef | moveMkr"/>
</wrd>
</line>
<line>
Expand All @@ -178,6 +238,21 @@ Main template
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--
moveMkr
-->
<xsl:template match="moveMkr">
<object type="tMovedMkr">
<xsl:choose>
<xsl:when test=".='Preposed'">
<xsl:text>&lt;&lt; </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text> &gt;&gt;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</object>
</xsl:template>
<!--
row
-->
Expand Down Expand Up @@ -207,7 +282,31 @@ Main template
<xsl:if test="count(preceding-sibling::*) &gt; 0">
<xsl:text>&#x20;</xsl:text>
</xsl:if>
<xsl:apply-templates/>
<xsl:choose>
<xsl:when test="ancestor::row[@type='speech']">
<object type="tSpeech">
<xsl:apply-templates/>
</object>
</xsl:when>
<xsl:when test="ancestor::row[@type='song']">
<object type="tSong">
<xsl:apply-templates/>
</object>
</xsl:when>
<xsl:when test="ancestor::row[@type='dependent']">
<object type="tDependent">
<xsl:apply-templates/>
</object>
</xsl:when>
<xsl:when test="@moved='true'">
<object type="tMoved">
<xsl:apply-templates/>
</object>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</langData>
</xsl:template>
</xsl:stylesheet>
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<FxtDocumentDescription dataLabel="XLingPaper" formatLabel="XML" defaultExtension="xml" filter="XML files (*.xml)|*.xml|All files (*.*)|*.*" mode="applySingleTransform" transform="Discourse2XLingPaper.xsl">
<p>Export the discourse chart to a basic XLingPaper document which can then be used to cut and paste into another XLingPaper document. XLingPaper is a way to write linguistic papers using XML technologies. </p>
<p>Some of us like using the freely available XMLmind XML Editor with the XLingPaper configuration files for XMLmind to do this editing. See
<a href="https://software.sil.org/xlingpaper/">https://software.sil.org/xlingpaper/</a></p>
<p>Export the discourse chart to a basic XLingPaper document which can then be used to cut and paste into another XLingPaper document.</p>
<p>XLingPaper is a way to write linguistic papers using XML technologies. Some of us like using the freely available XMLmind XML Editor with the XLingPaper configuration files for XMLmind to do this editing. See <a href="http://software.sil.org/xlingpaper/">http://software.sil.org/xlingpaper/</a>.</p>
</FxtDocumentDescription>
Original file line number Diff line number Diff line change
Expand Up @@ -233,17 +233,14 @@
</xsl:if>-->
</language>
</xsl:if>
<xsl:if test="key('ItemsLang',$sLangId)[parent::word and following-sibling::morphemes or parent::word and not(following-sibling::morphemes) and @type='txt']">
<language font-family="{$sFont}" id="{$sLangId}-baseline">
<!--<xsl:if test="@vernacular='true'">
<xsl:attribute name="name">vernacular</xsl:attribute>
</xsl:if>-->
</language>
</xsl:if>
<xsl:if test="key('ItemsLang',$sLangId)[parent::word and @type='punct']">
<language font-family="{$sFont}" id="{$sLangId}-baseline">
</language>
</xsl:if>
<xsl:choose>
<xsl:when test="key('ItemsLang',$sLangId)[parent::word and following-sibling::morphemes or parent::word and not(following-sibling::morphemes) and @type='txt']">
<language font-family="{$sFont}" id="{$sLangId}-baseline"/>
</xsl:when>
<xsl:when test="key('ItemsLang',$sLangId)[parent::word and @type='punct']">
<language font-family="{$sFont}" id="{$sLangId}-baseline"/>
</xsl:when>
</xsl:choose>
<xsl:if test="key('ItemsLang',$sLangId)[parent::word and @type='pos']">
<language font-family="{$sFont}" id="{$sLangId}-wordCategory"/>
</xsl:if>
Expand Down
11 changes: 8 additions & 3 deletions Src/LexText/Interlinear/ChooseAnalysisHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ public void SetupCombo()
}
}

// Add option to clear the analysis altogeter.
// Add option to clear the analysis altogether.
AddItem(wordform, MakeSimpleString(ITextStrings.ksNewAnalysis), false, WfiWordformTags.kClassId);
// Add option to reset to the default
AddItem(null, MakeSimpleString(ITextStrings.ksUseDefaultAnalysis), false);
Expand Down Expand Up @@ -374,7 +374,6 @@ internal static ITsString MakeAnalysisStringRep(IWfiAnalysis wa, LcmCache fdoCac
ITsTextProps formTextProperties = FormTextProperties(fdoCache, fUseStyleSheet, wsVern);
ITsTextProps glossTextProperties = GlossTextProperties(fdoCache, true, fUseStyleSheet);
ITsStrBldr tsb = TsStringUtils.MakeStrBldr();
ISilDataAccess sda = fdoCache.MainCacheAccessor;
int cmorph = wa.MorphBundlesOS.Count;
if (cmorph == 0)
return TsStringUtils.MakeString(ITextStrings.ksNoMorphemes, fdoCache.DefaultUserWs);
Expand Down Expand Up @@ -436,7 +435,12 @@ internal static ITsString MakeAnalysisStringRep(IWfiAnalysis wa, LcmCache fdoCac
if (sense != null)
{
ITsString tssGloss = sense.Gloss.get_String(fdoCache.DefaultAnalWs);
tsb.Replace(ichMinSense, ichMinSense, tssGloss.Text, glossTextProperties);
var inflType = mb.InflTypeRA;
var glossAccessor = sense.Gloss;
var wsAnalysis = fdoCache.ServiceLocator.WritingSystemManager.Get(fdoCache.DefaultAnalWs);
var tssSense = MorphServices.MakeGlossOptionWithInflVariantTypes(inflType, glossAccessor, wsAnalysis);
var displayText = tssSense?.Text ?? tssGloss.Text;
tsb.Replace(ichMinSense, ichMinSense, displayText, glossTextProperties);
}
else
tsb.Replace(ichMinSense, ichMinSense, ksMissingString, glossTextProperties);
Expand Down Expand Up @@ -569,6 +573,7 @@ public void Activate(Rect loc)
combo.Location = new System.Drawing.Point(loc.left, loc.top);
// 21 is the default height of a combo, the smallest reasonable size.
combo.Size = new System.Drawing.Size(Math.Max(loc.right - loc.left + 30, 200), Math.Max( loc.bottom - loc.top, 50));

if (!m_owner.Controls.Contains(combo))
m_owner.Controls.Add(combo);
}
Expand Down
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 @@ -24,6 +24,7 @@
( (left orderclassmin < current orderclassmin)
AND (left orderclassmax < current orderclassmax) )
OR (current orderclass = 0)
OR (left orderclass = 0)
OR ((current orderclass = -1) AND (left orderclass = -1))
OR ((current orderclass = -1) AND (left orderclass = 0))
OR ((current orderclass = -32000) AND (left orderclass = -32000))
Expand All @@ -37,6 +38,7 @@ OR ((left orderclass = -1) AND (current orderclass ~= -32000)) | allow derivatio
( (left orderclassmin < current orderclassmin)
AND (left orderclassmax < current orderclassmax) )
OR (current orderclass = 0)
OR (left orderclass = 0)
OR ((current orderclass = -1) AND (left orderclass = -1))
OR ((current orderclass = -32000) AND (left orderclass = -32000))
OR ((current orderclassmin = -31999) AND (current orderclassmax = -1))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
( (left orderclassmin < current orderclassmin)
AND (left orderclassmax < current orderclassmax) )
OR (current orderclass = 0)
OR (left orderclass = 0)
OR ((current orderclass = -1) AND (left orderclass = -1))
OR ((current orderclass = -1) AND (left orderclass = 0))
OR ((current orderclass = -32000) AND (left orderclass = -32000))
Expand All @@ -60,6 +61,7 @@ OR ((left orderclass = -1) AND (current orderclass ~= -32000)) | allow derivatio
( (left orderclassmin < current orderclassmin)
AND (left orderclassmax < current orderclassmax) )
OR (current orderclass = 0)
OR (left orderclass = 0)
OR ((current orderclass = -1) AND (left orderclass = -1))
OR ((current orderclass = -32000) AND (left orderclass = -32000))
OR ((current orderclassmin = -31999) AND (current orderclassmax = -1))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
( (left orderclassmin < current orderclassmin)
AND (left orderclassmax < current orderclassmax) )
OR (current orderclass = 0)
OR (left orderclass = 0)
OR ((current orderclass = -1) AND (left orderclass = -1))
OR ((current orderclass = -1) AND (left orderclass = 0))
OR ((current orderclass = -32000) AND (left orderclass = -32000))
Expand All @@ -37,6 +38,7 @@ OR ((left orderclass = -1) AND (current orderclass ~= -32000)) | allow derivatio
( (left orderclassmin < current orderclassmin)
AND (left orderclassmax < current orderclassmax) )
OR (current orderclass = 0)
OR (left orderclass = 0)
OR ((current orderclass = -1) AND (left orderclass = -1))
OR ((current orderclass = -32000) AND (left orderclass = -32000))
OR ((current orderclassmin = -31999) AND (current orderclassmax = -1))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
( (left orderclassmin < current orderclassmin)
AND (left orderclassmax < current orderclassmax) )
OR (current orderclass = 0)
OR (left orderclass = 0)
OR ((current orderclass = -1) AND (left orderclass = -1))
OR ((current orderclass = -1) AND (left orderclass = 0))
OR ((current orderclass = -32000) AND (left orderclass = -32000))
Expand All @@ -37,6 +38,7 @@ OR ((left orderclass = -1) AND (current orderclass ~= -32000)) | allow derivatio
( (left orderclassmin < current orderclassmin)
AND (left orderclassmax < current orderclassmax) )
OR (current orderclass = 0)
OR (left orderclass = 0)
OR ((current orderclass = -1) AND (left orderclass = -1))
OR ((current orderclass = -32000) AND (left orderclass = -32000))
OR ((current orderclassmin = -31999) AND (current orderclassmax = -1))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
( (left orderclassmin < current orderclassmin)
AND (left orderclassmax < current orderclassmax) )
OR (current orderclass = 0)
OR (left orderclass = 0)
OR ((current orderclass = -1) AND (left orderclass = -1))
OR ((current orderclass = -1) AND (left orderclass = 0))
OR ((current orderclass = -32000) AND (left orderclass = -32000))
Expand All @@ -68,6 +69,7 @@ OR ((left orderclass = -1) AND (current orderclass ~= -32000)) | allow derivatio
( (left orderclassmin < current orderclassmin)
AND (left orderclassmax < current orderclassmax) )
OR (current orderclass = 0)
OR (left orderclass = 0)
OR ((current orderclass = -1) AND (left orderclass = -1))
OR ((current orderclass = -32000) AND (left orderclass = -32000))
OR ((current orderclassmin = -31999) AND (current orderclassmax = -1))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
( (left orderclassmin < current orderclassmin)
AND (left orderclassmax < current orderclassmax) )
OR (current orderclass = 0)
OR (left orderclass = 0)
OR ((current orderclass = -1) AND (left orderclass = -1))
OR ((current orderclass = -1) AND (left orderclass = 0))
OR ((current orderclass = -32000) AND (left orderclass = -32000))
Expand All @@ -94,6 +95,7 @@ OR ((left orderclass = -1) AND (current orderclass ~= -32000)) | allow derivatio
( (left orderclassmin < current orderclassmin)
AND (left orderclassmax < current orderclassmax) )
OR (current orderclass = 0)
OR (left orderclass = 0)
OR ((current orderclass = -1) AND (left orderclass = -1))
OR ((current orderclass = -32000) AND (left orderclass = -32000))
OR ((current orderclassmin = -31999) AND (current orderclassmax = -1))
Expand Down
Loading

0 comments on commit 18ed156

Please sign in to comment.