@@ -394,6 +394,14 @@ private static void UpdatePhraseTextForWordItems(ILgWritingSystemFactory wsFacto
394394 }
395395 }
396396
397+ private static bool IsGuess ( Morphemes item )
398+ {
399+ if ( item != null && item . analysisStatusSpecified &&
400+ ( item . analysisStatus != analysisStatusTypes . humanApproved ) )
401+ return true ;
402+ return false ;
403+ }
404+
397405 private static ITsString GetItemValue ( item item , ILgWritingSystemFactory wsFactory )
398406 {
399407 if ( item . run != null )
@@ -754,7 +762,8 @@ private static IAnalysis CreateWordformWithWfiAnalysis(LcmCache cache, Word word
754762 return null ;
755763
756764 // Fill in morphemes, lex. entries, lex. gloss, and lex.gram.info
757- if ( word . morphemes != null && word . morphemes . morphs . Length > 0 )
765+ if ( word . morphemes != null && word . morphemes . morphs . Length > 0 &&
766+ word . morphemes . analysisStatus == analysisStatusTypes . humanApproved )
758767 {
759768 var lex_entry_repo = cache . ServiceLocator . GetInstance < ILexEntryRepository > ( ) ;
760769 var msa_repo = cache . ServiceLocator . GetInstance < IMoMorphSynAnalysisRepository > ( ) ;
@@ -1007,6 +1016,12 @@ private static bool FindOrCreateWfiAnalysis(LcmCache cache, Word word,
10071016 break ;
10081017 }
10091018 }
1019+ if ( word . morphemes != null && word . morphemes . analysisStatus != analysisStatusTypes . humanApproved )
1020+ {
1021+ // If the morphemes were guessed then the glosses and cats were also guessed.
1022+ expectedGlosses . Clear ( ) ;
1023+ expectedCats . Clear ( ) ;
1024+ }
10101025
10111026 if ( candidateForm == null || ! MatchPrimaryFormAndAddMissingAlternatives ( candidateForm , expectedForms , mainWritingSystem ) )
10121027 {
@@ -1024,7 +1039,8 @@ private static bool FindOrCreateWfiAnalysis(LcmCache cache, Word word,
10241039 analysis = candidateWordform ;
10251040 // If no glosses or morphemes are expected the wordform itself is the match
10261041 if ( expectedGlosses . Count == 0
1027- && ( word . morphemes == null || word . morphemes . morphs . Length == 0 ) )
1042+ && ( word . morphemes == null || word . morphemes . morphs . Length == 0 ||
1043+ word . morphemes . analysisStatus != analysisStatusTypes . humanApproved ) )
10281044 {
10291045 analysis = GetMostSpecificAnalysisForWordForm ( candidateWordform ) ;
10301046 return true ;
@@ -1068,7 +1084,7 @@ private static IAnalysis FindMatchingAnalysis(LcmCache cache, IWfiWordform candi
10681084 var morphemeMatch = true ;
10691085 // verify that the analysis has a Morph Bundle with the expected morphemes from the import
10701086 if ( word . morphemes != null && wfiAnalysis . MorphBundlesOS . Count == word . morphemes ? . morphs . Length &&
1071- word . morphemes . analysisStatus == analysisStatusTypes . humanApproved )
1087+ ! IsGuess ( word . morphemes ) )
10721088 {
10731089 analysis = GetMostSpecificAnalysisForWordForm ( wfiAnalysis ) ;
10741090 for ( var i = 0 ; i < wfiAnalysis . MorphBundlesOS . Count ; ++ i )
@@ -1284,7 +1300,7 @@ private static void UpgradeToWordGloss(Word word, ref IAnalysis wordForm)
12841300 analysisTree = new AnalysisTree ( wfiGloss ) ;
12851301 }
12861302 analysisTree . Gloss . Form . set_String ( wsNewGloss , wordGlossItem . Value ) ;
1287- if ( word . morphemes ? . analysisStatus != analysisStatusTypes . guess )
1303+ if ( ! IsGuess ( word . morphemes ) )
12881304 // Make sure this analysis is marked as user-approved (green check mark)
12891305 cache . LangProject . DefaultUserAgent . SetEvaluation (
12901306 analysisTree . WfiAnalysis , Opinions . approves ) ;
@@ -1305,7 +1321,7 @@ private static void UpgradeToWordGloss(Word word, ref IAnalysis wordForm)
13051321 }
13061322 }
13071323
1308- if ( wordForm != null && word . morphemes ? . analysisStatus == analysisStatusTypes . guess )
1324+ if ( wordForm != null && IsGuess ( word . morphemes ) )
13091325 // Ignore gloss if morphological analysis was only a guess.
13101326 wordForm = wordForm . Wordform ;
13111327 }
0 commit comments