From 2c0ae9f48393d14cc7c8087f5728b32fa39518a0 Mon Sep 17 00:00:00 2001 From: Enkidu93 Date: Mon, 25 Nov 2024 20:16:29 -0500 Subject: [PATCH] Fix merge error --- ...> ParallelCorpusProcessingServiceTests.cs} | 2 +- .../Services/ParallelCorpusProcessorTests.cs | 98 ------------------- 2 files changed, 1 insertion(+), 99 deletions(-) rename src/ServiceToolkit/test/SIL.ServiceToolkit.Tests/Services/{ParallelCorpusProcessorServiceTests.cs => ParallelCorpusProcessingServiceTests.cs} (98%) delete mode 100644 src/ServiceToolkit/test/SIL.ServiceToolkit.Tests/Services/ParallelCorpusProcessorTests.cs diff --git a/src/ServiceToolkit/test/SIL.ServiceToolkit.Tests/Services/ParallelCorpusProcessorServiceTests.cs b/src/ServiceToolkit/test/SIL.ServiceToolkit.Tests/Services/ParallelCorpusProcessingServiceTests.cs similarity index 98% rename from src/ServiceToolkit/test/SIL.ServiceToolkit.Tests/Services/ParallelCorpusProcessorServiceTests.cs rename to src/ServiceToolkit/test/SIL.ServiceToolkit.Tests/Services/ParallelCorpusProcessingServiceTests.cs index 4a0c1d27..543332e2 100644 --- a/src/ServiceToolkit/test/SIL.ServiceToolkit.Tests/Services/ParallelCorpusProcessorServiceTests.cs +++ b/src/ServiceToolkit/test/SIL.ServiceToolkit.Tests/Services/ParallelCorpusProcessingServiceTests.cs @@ -1,7 +1,7 @@ namespace SIL.ServiceToolkit.Services; [TestFixture] -public class ParallelCorpusPreprocessorServiceTests +public class ParallelCorpusPreprocessingServiceTests { private static readonly string TestDataPath = Path.Combine( AppContext.BaseDirectory, diff --git a/src/ServiceToolkit/test/SIL.ServiceToolkit.Tests/Services/ParallelCorpusProcessorTests.cs b/src/ServiceToolkit/test/SIL.ServiceToolkit.Tests/Services/ParallelCorpusProcessorTests.cs deleted file mode 100644 index 75c19878..00000000 --- a/src/ServiceToolkit/test/SIL.ServiceToolkit.Tests/Services/ParallelCorpusProcessorTests.cs +++ /dev/null @@ -1,98 +0,0 @@ -using SIL.ServiceToolkit.Services; - -namespace SIL.ServiceToolkit.Utils; - -[TestFixture] -public class ParallelCorpusPreprocessorTests -{ - private static readonly string TestDataPath = Path.Combine( - AppContext.BaseDirectory, - "..", - "..", - "..", - "Utils", - "data" - ); - - [Test] - public void TestParallelCorpusPreprocessor() - { - var processor = new ParallelCorpusPreprocessingService(new CorpusService()); - List corpora = - new() - { - new() - { - Id = "corpus1", - SourceCorpora = new List - { - new MonolingualCorpus() - { - Id = "source-corpus1", - Language = "en", - Files = new List - { - new() - { - TextId = "textId1", - Format = FileFormat.Text, - Location = Path.Combine(TestDataPath, "source1.txt") - } - } - }, - new MonolingualCorpus() - { - Id = "source-corpus2", - Language = "en", - Files = new List - { - new() - { - TextId = "textId1", - Format = FileFormat.Text, - Location = Path.Combine(TestDataPath, "source2.txt") - } - } - } - }, - TargetCorpora = new List - { - new MonolingualCorpus() - { - Id = "target-corpus1", - Language = "en", - Files = new List - { - new() - { - TextId = "textId1", - Format = FileFormat.Text, - Location = Path.Combine(TestDataPath, "target1.txt") - } - } - } - } - } - }; - int trainCount = 0; - int pretranslateCount = 0; - processor.Preprocess( - corpora, - row => - { - if (row.SourceSegment.Length > 0 && row.TargetSegment.Length > 0) - trainCount++; - }, - (row, corpus) => - { - pretranslateCount++; - }, - false - ); - Assert.Multiple(() => - { - Assert.That(trainCount, Is.EqualTo(2)); - Assert.That(pretranslateCount, Is.EqualTo(3)); - }); - } -}