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

Refactor models to records #172

Merged
merged 1 commit into from
Feb 22, 2024
Merged

Refactor models to records #172

merged 1 commit into from
Feb 22, 2024

Conversation

ddaspit
Copy link
Contributor

@ddaspit ddaspit commented Feb 21, 2024

This change is Reviewable

@johnml1135
Copy link
Collaborator

Why are the options not also converted?

@johnml1135
Copy link
Collaborator

src/SIL.Machine.AspNetCore/Services/NmtPreprocessBuildJob.cs line 87 at r1 (raw file):

        Dictionary<string, int> counts = new();
        counts["CorpusSize"] = 0;

Why is corpus size removed?

@johnml1135
Copy link
Collaborator

src/SIL.Machine.AspNetCore/Services/NmtPreprocessBuildJob.cs line 117 at r1 (raw file):

                        corpus.TrainOnTextIds.Add(keyTermsTextIds.First()); //Should only be one textId for key terms
                    parallelCorpora.Add(parallelKeyTermsCorpus);
                }

Why was this removed?

@johnml1135
Copy link
Collaborator

src/SIL.Machine.AspNetCore/Services/NmtPreprocessBuildJob.cs line 117 at r1 (raw file):

Previously, johnml1135 (John Lambert) wrote…

Why was this removed?

Why was it moved below?

@johnml1135
Copy link
Collaborator

src/SIL.Machine.AspNetCore/Services/NmtPreprocessBuildJob.cs line 171 at r1 (raw file):

                        await sourceTrainWriter.WriteAsync($"{row.SourceText}\n");
                        await targetTrainWriter.WriteAsync($"{row.TargetText}\n");
                        trainCount++;

Is this tested?

Copy link
Collaborator

@johnml1135 johnml1135 left a comment

Choose a reason for hiding this comment

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

Reviewed 30 of 30 files at r1, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @ddaspit)

Copy link
Contributor Author

@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.

I was focusing on the models. We could convert the option classes to records in a future PR.

Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @johnml1135)


src/SIL.Machine.AspNetCore/Services/NmtPreprocessBuildJob.cs line 87 at r1 (raw file):

Previously, johnml1135 (John Lambert) wrote…

Why is corpus size removed?

I believe that the corpus size and the train count were trying to capture the same thing.


src/SIL.Machine.AspNetCore/Services/NmtPreprocessBuildJob.cs line 117 at r1 (raw file):

Previously, johnml1135 (John Lambert) wrote…

Why was it moved below?

The models were updated to be immutable. The old logic worked by updating a property of the model, which isn't a great idea anyway. To avoid updating the model, I moved the code below. I think the logic is clearer this way as well.


src/SIL.Machine.AspNetCore/Services/NmtPreprocessBuildJob.cs line 171 at r1 (raw file):

Previously, johnml1135 (John Lambert) wrote…

Is this tested?

It looks like there are some unit tests for key terms.

@johnml1135
Copy link
Collaborator

Tracked here: #174

Copy link
Collaborator

@johnml1135 johnml1135 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: :shipit: complete! all files reviewed, all discussions resolved (waiting on @ddaspit)

@johnml1135 johnml1135 merged commit d295258 into master Feb 22, 2024
4 checks passed
@johnml1135 johnml1135 deleted the records branch February 22, 2024 20:54
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.

2 participants