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

Add versification table implementation #283

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Enkidu93
Copy link
Collaborator

@Enkidu93 Enkidu93 commented Jan 21, 2025

Fixes #241

Once this goes through, a change will need to be made in Serval to the ZipParatextProjectSettingsParser.


This change is Reviewable

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 78.78788% with 14 lines in your changes missing coverage. Please review.

Project coverage is 70.26%. Comparing base (c304a75) to head (dcafca2).

Files with missing lines Patch % Lines
src/SIL.Machine/Corpora/VersificationTableBase.cs 68.42% 10 Missing and 2 partials ⚠️
src/SIL.Machine/Corpora/ZipVersificationTable.cs 85.71% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master     #283   +/-   ##
=======================================
  Coverage   70.26%   70.26%           
=======================================
  Files         385      388    +3     
  Lines       31957    32008   +51     
  Branches     4488     4494    +6     
=======================================
+ Hits        22455    22492   +37     
- Misses       8463     8474   +11     
- Partials     1039     1042    +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@ddaspit ddaspit left a comment

Choose a reason for hiding this comment

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

Reviewed 6 of 6 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @Enkidu93 and @johnml1135)


src/SIL.Machine/Corpora/VersificationTableBase.cs line 7 at r1 (raw file):

namespace SIL.Machine.Corpora
{
    public abstract class VersificationTableBase : Versification.Table

Is there some way that we could make this implementation stateless? We don't want to save every versification that we load. It could create a subtle memory leak when applications use Machine. I wish there was some way we could bypass this table when loading a versification. Worse comes to worse, we could remove all custom versifications after we load a versification. If we could just make the proper Load method protected, then we could make a stateless table.


src/SIL.Machine/Corpora/FileParatextProjectSettingsParser.cs line 14 at r1 (raw file):

        {
            _projectDir = projectDir;
            Versification.Table.Implementation = new FileVersificationTable(projectDir);

Versification.Table.Implementation is a static singleton. If we try to use FileParatextProjectSettingsParser and ZipParatextProjectSettingsParser in the same process, then they might stomp on each other, causing the code to break in weird ways, since the wrong versification table implementation would be used. Is there some way we could use the same implementation for both parsers? Maybe use a special path for zip files.

Copy link
Collaborator Author

@Enkidu93 Enkidu93 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: all files reviewed, 2 unresolved discussions (waiting on @ddaspit and @johnml1135)


src/SIL.Machine/Corpora/FileParatextProjectSettingsParser.cs line 14 at r1 (raw file):

Previously, ddaspit (Damien Daspit) wrote…

Versification.Table.Implementation is a static singleton. If we try to use FileParatextProjectSettingsParser and ZipParatextProjectSettingsParser in the same process, then they might stomp on each other, causing the code to break in weird ways, since the wrong versification table implementation would be used. Is there some way we could use the same implementation for both parsers? Maybe use a special path for zip files.

OK, yes, I'll stew on it.


src/SIL.Machine/Corpora/VersificationTableBase.cs line 7 at r1 (raw file):

Previously, ddaspit (Damien Daspit) wrote…

Is there some way that we could make this implementation stateless? We don't want to save every versification that we load. It could create a subtle memory leak when applications use Machine. I wish there was some way we could bypass this table when loading a versification. Worse comes to worse, we could remove all custom versifications after we load a versification. If we could just make the proper Load method protected, then we could make a stateless table.

Yes, sorry! I think I forgot why we were doing this in the first place 😅 - looking into it. I think we may be able to get around adding the versification to the table.

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.

Error parsing Paratext settings
3 participants