Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
\eType prefix


\lx 4157
\lx 4157.0.3193
\g believe.pst.pl
\c W
\wc root
Expand All @@ -67,7 +67,7 @@
\mp IrregInflForm6652


\lx 4157.0
\lx 4157.0.9872
\g seek.pst.pl
\c W
\wc root
Expand Down Expand Up @@ -161,7 +161,7 @@
\a bos {9892}


\lx 8236
\lx 8236.0.3193
\g believe.prs
\c W
\wc root
Expand Down Expand Up @@ -226,7 +226,7 @@
\a mot {9698}


\lx 10257
\lx 10257.0.4664
\g second sense.pst
\c W
\wc root
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@
\a maghuighuina {26872}


\lx 4115
\lx 4115.0.81036
\g defecate
\c W
\wc root
Expand Down Expand Up @@ -3919,7 +3919,7 @@
\a angalua {81043}


\lx 23464
\lx 23464.0.61372
\g laugh.RDP
\c W
\wc root
Expand All @@ -3928,7 +3928,7 @@
\mp IrregInflForm71052


\lx 23464
\lx 23464.0.120453
\g laugh.RDP
\c W
\wc root
Expand Down Expand Up @@ -5990,7 +5990,7 @@
\a apere {75597}


\lx 33818
\lx 33818.0.76068
\g POSS.3SG
\c W
\wc root
Expand Down Expand Up @@ -7132,7 +7132,7 @@
\a natuena {72026}


\lx 39937
\lx 39937.0.57373
\g body
\c W
\wc root
Expand Down Expand Up @@ -8150,7 +8150,7 @@
\eType suffix


\lx 45889
\lx 45889.0.92329
\g wife
\c W
\wc root
Expand Down Expand Up @@ -9443,7 +9443,7 @@
\a sausaukaa {115103}


\lx 53296
\lx 53296.0.35188
\g 1PAU.EXCL
\c W
\wc root
Expand Down Expand Up @@ -12726,7 +12726,7 @@
\a palepale {67250}


\lx 70895
\lx 70895.0.148174
\g handle
\c W
\wc root
Expand Down Expand Up @@ -14191,7 +14191,7 @@
\a tumtumlana {51181}


\lx 78967
\lx 78967.0.119135
\g end
\c W
\wc root
Expand Down Expand Up @@ -14815,7 +14815,7 @@
\a parroe {84866}


\lx 82227
\lx 82227.0.106969
\g push.aside.RDP
\c W
\wc root
Expand Down Expand Up @@ -15728,7 +15728,7 @@
\a kotolungaulu {46644}


\lx 87184
\lx 87184.0.32313
\g sleep.RDP
\c W
\wc root
Expand All @@ -15737,7 +15737,7 @@
\mp IrregInflForm71052


\lx 87184
\lx 87184.0.90982
\g sleep.RDP
\c W
\wc root
Expand Down Expand Up @@ -21412,7 +21412,7 @@
\a tuvu {11507}


\lx 117012
\lx 117012.0.49223
\g our
\c W
\wc root
Expand Down Expand Up @@ -24079,7 +24079,7 @@
\a aippetana {137436}


\lx 129944
\lx 129944.0.78733
\g taste
\c W
\wc root
Expand Down
24 changes: 15 additions & 9 deletions Src/LexText/ParserCore/ParserXmlWriterExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2015 SIL International
// Copyright (c) 2015 SIL International
// This software is licensed under the LGPL, version 2.1 or later
// (http://www.gnu.org/licenses/lgpl-2.1.html)

Expand All @@ -18,16 +18,19 @@ namespace SIL.FieldWorks.WordWorks.Parser
{
internal static class ParserXmlWriterExtensions
{
private static Tuple<int, int> ProcessMsaHvo(string msaHvo)
private static Tuple<int, int, int> ProcessMsaHvo(string msaHvo)
{
string[] msaHvoParts = msaHvo.Split('.');
return Tuple.Create(int.Parse(msaHvoParts[0]), msaHvoParts.Length == 2 ? int.Parse(msaHvoParts[1]) : 0);
// the msa hvo has one part or three parts separated by a period.
// in the latter case, it is the lex entry hvo, the lex ref hvo, and the msa hvo
return Tuple.Create(int.Parse(msaHvoParts[0]), msaHvoParts.Length == 3 ? int.Parse(msaHvoParts[1]) : 0,
msaHvoParts.Length == 3 ? int.Parse(msaHvoParts[2]) : 0);
}

public static void WriteMsaElement(this XmlWriter writer, LcmCache cache, string formID, string msaID, string type, string wordType)
{
// Irregulary inflected forms can have a combination MSA hvo: the LexEntry hvo, a period, and an index to the LexEntryRef
Tuple<int, int> msaTuple = ProcessMsaHvo(msaID);
Tuple<int, int, int> msaTuple = ProcessMsaHvo(msaID);
ICmObject obj = cache.ServiceLocator.GetInstance<ICmObjectRepository>().GetObject(msaTuple.Item1);
switch (obj.GetType().Name)
{
Expand All @@ -52,9 +55,9 @@ public static void WriteMsaElement(this XmlWriter writer, LcmCache cache, string
var entry = (ILexEntry) obj;
if (entry.EntryRefsOS.Count > 0)
{
ILexEntryRef lexEntryRef = entry.EntryRefsOS[msaTuple.Item2];
ILexSense sense = MorphServices.GetMainOrFirstSenseOfVariant(lexEntryRef);
WriteStemMsaXmlElement(writer, (IMoStemMsa) sense.MorphoSyntaxAnalysisRA, entry.VariantEntryRefs);
// use the msa itself
IMoStemMsa stemMsa = (IMoStemMsa)cache.ServiceLocator.GetInstance<ICmObjectRepository>().GetObject(msaTuple.Item3);
WriteStemMsaXmlElement(writer, stemMsa, entry.VariantEntryRefs);
}
break;
case "LexEntryInflType":
Expand Down Expand Up @@ -328,7 +331,7 @@ public static void WriteMorphInfoElements(this XmlWriter writer, LcmCache cache,
int iFirstSpace = shortName.IndexOf(" (", StringComparison.Ordinal);
int iLastSpace = shortName.LastIndexOf("):", StringComparison.Ordinal) + 2;
alloform = shortName.Substring(0, iFirstSpace);
Tuple<int, int> msaTuple = ProcessMsaHvo(msaID);
Tuple<int, int, int> msaTuple = ProcessMsaHvo(msaID);
ICmObject msaObj = cache.ServiceLocator.GetObject(msaTuple.Item1);
if (msaObj.ClassID == LexEntryTags.kClassId)
{
Expand All @@ -344,7 +347,10 @@ public static void WriteMorphInfoElements(this XmlWriter writer, LcmCache cache,
MorphServices.JoinGlossAffixesOfInflVariantTypes(lexEntryRef.VariantEntryTypesRS,
glossWs, out sbGlossPrepend, out sbGlossAppend);
ITsIncStrBldr sbGloss = sbGlossPrepend;
sbGloss.Append(sense.Gloss.BestAnalysisAlternative.Text);
// use the gloss of the first sense of the MSA
IMoStemMsa stemMsa = (IMoStemMsa)cache.ServiceLocator.GetInstance<ICmObjectRepository>().GetObject(msaTuple.Item3);
string msaGloss = (stemMsa != null) ? stemMsa.GetGlossOfFirstSense() : "***";
sbGloss.Append(msaGloss);
sbGloss.Append(sbGlossAppend.Text);
gloss = sbGloss.Text;
}
Expand Down
15 changes: 10 additions & 5 deletions Src/Transforms/Application/FxtM3ParserCommon.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,16 @@
<xsl:param name="msa"/>
<xsl:value-of select="$lexEntry/@Id"/>
<xsl:variable name="iPos" select="count($lexEntryRef/preceding-sibling::LexEntryRef)"/>
<xsl:if test="$iPos &gt; 0">
<xsl:text>.</xsl:text>
<!-- Subtracting 1 to account for 0-indexing in C# -->
<xsl:value-of select="$iPos - 1"/>
</xsl:if>
<xsl:text>.</xsl:text>
<xsl:choose>
<xsl:when test="$iPos &gt; 0">
<!-- Subtracting 1 to account for 0-indexing in C# -->
<xsl:value-of select="$iPos - 1"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>0</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="AppendAnyMsaCountNumber">
<xsl:with-param name="msa" select="$msa"/>
</xsl:call-template>
Expand Down
20 changes: 9 additions & 11 deletions Src/Transforms/Application/FxtM3ParserToXAmpleLex.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -2166,17 +2166,15 @@ InflClass
<xsl:param name="lexEntry"/>
<xsl:param name="sVariantOfGloss"/>
<xsl:param name="stemMsa"/>
<xsl:choose>
<xsl:when test="key('LexEntryInflTypes',$lexEntryRef/LexEntryType/@dst)">
<xsl:call-template name="IdOfVariantEntry">
<xsl:with-param name="lexEntry" select="$lexEntry"/>
<xsl:with-param name="lexEntryRef" select="$lexEntryRef"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$stemMsa/@Id"/>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="key('LexEntryInflTypes',$lexEntryRef/LexEntryType/@dst)">
<!-- we produce sn id that has three parts separated by a period: the lex entry, the lex ref, and the msa -->
<xsl:call-template name="IdOfVariantEntry">
<xsl:with-param name="lexEntry" select="$lexEntry"/>
<xsl:with-param name="lexEntryRef" select="$lexEntryRef"/>
</xsl:call-template>
<xsl:text>.</xsl:text>
</xsl:if>
<xsl:value-of select="$stemMsa/@Id"/>
<xsl:variable name="gloss">
<xsl:call-template name="GlossOfVariant">
<xsl:with-param name="lexEntryRef" select="$lexEntryRef"/>
Expand Down
Loading