Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix interlinear flextext importing #154

Merged
merged 7 commits into from
Sep 4, 2024

Conversation

jasonleenaylor
Copy link
Contributor

@jasonleenaylor jasonleenaylor commented Sep 3, 2024

  • Correct import of morphemes, lex. entries, lex. gloss, and lex. info

This change is Reviewable

*Correct display of morphemes, lex. entries, lex. gloss, and lex. info
@jasonleenaylor
Copy link
Contributor Author

Src/LexText/Interlinear/ITextDll.csproj line 7 at r1 (raw file):

    <ProductVersion>9.0.30729</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{1F02ABF7-430D-4E00-A388-3CBF7700792D}</ProjectGuid>

Not sure how or why this changed, but we should revert it.

@jasonleenaylor
Copy link
Contributor Author

Src/LexText/Interlinear/BIRDInterlinearImporter.cs line 22 at r2 (raw file):

using SIL.LCModel.Infrastructure;
using SIL.LCModel.Utils;
using Gecko.WebIDL;

Remove if unnecessary

@jasonleenaylor
Copy link
Contributor Author

Src/LexText/Interlinear/BIRDInterlinearImporter.cs line 774 at r2 (raw file):

				{
					ILexEntryRepository lex_entry_repo = cache.ServiceLocator.GetInstance<ILexEntryRepository>();
					IMoMorphSynAnalysisRepository msa_repo = cache.ServiceLocator.GetInstance<IMoMorphSynAnalysisRepository>();

move the repo defs outside of the loop.

@jasonleenaylor
Copy link
Contributor Author

Src/LexText/Interlinear/BIRDInterlinearImporter.cs line 789 at r2 (raw file):

					{
						int ws = GetWsEngine(wsFact, itemDict["txt"].Item1).Handle;
						ITsString wf = TsStringUtils.MakeString(itemDict["txt"].Item2, ws);

make a variable for itemDict["txt"].Item2 - var morphForm

@jasonleenaylor
Copy link
Contributor Author

Src/LexText/Interlinear/BIRDInterlinearImporter.cs line 792 at r2 (raw file):

						// If we already have a bundle use that one
						bundle =

Instead of firstordefault check the bundle at the index (properly guarded)

@jasonleenaylor
Copy link
Contributor Author

Src/LexText/Interlinear/BIRDInterlinearImporter.cs line 812 at r2 (raw file):

						var entries = lex_entry_repo.AllInstances().Where(
							m => StringServices.CitationFormWithAffixTypeStaticForWs(m, ws_cf, string.Empty) == itemDict["cf"].Item2);
						if (entries != null)

Verify that null is possible, if not remove this check.

Copy link
Contributor Author

@jasonleenaylor jasonleenaylor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 3 files reviewed, 8 unresolved discussions


Src/LexText/Interlinear/BIRDInterlinearImporter.cs line 823 at r2 (raw file):

								entry = entries.FirstOrDefault(m => m.HomographNumber.ToString() == itemDict["hn"].Item2);
							}
							else // Didn't find a match

Skip import if there are multiple entries but we aren't importing with a homograph number

Code quote:

Didn't find a match

Src/LexText/Interlinear/BIRDInterlinearImporter.cs line 825 at r2 (raw file):

							else // Didn't find a match
							{
								break;

I think continue is better here.

@jasonleenaylor jasonleenaylor merged commit 3c17a3a into release/9.1 Sep 4, 2024
3 of 5 checks passed
@jasonleenaylor jasonleenaylor deleted the feature/improveFlexImport branch September 4, 2024 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants