-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
Repopulate filename when building and creating USFM files
- Loading branch information
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace Serval.DataFiles.Contracts; | ||
|
||
public record DataFileReferenceDto | ||
{ | ||
public required string Id { get; init; } | ||
public required string Url { get; init; } | ||
public string? Name { get; init; } | ||
public required FileFormat Format { get; init; } | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace Serval.DataFiles.Models; | ||
|
||
public record DataFileReference | ||
{ | ||
public string Id { get; set; } = ""; | ||
public required string Name { get; init; } | ||
public required FileFormat Format { get; init; } | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
namespace Serval.Shared.Models; | ||
|
||
public record CorpusFile | ||
{ | ||
public required string Id { get; set; } | ||
public required FileFormat Format { get; set; } | ||
public required string TextId { get; set; } | ||
|
||
private string? _filename; | ||
|
||
public async Task PopulateFilenameAsync( | ||
IRequestClient<GetDataFile> getDataFileClient, | ||
string owner, | ||
CancellationToken cancellationToken | ||
) | ||
{ | ||
Response<DataFileResult, DataFileNotFound> response = await getDataFileClient.GetResponse< | ||
DataFileResult, | ||
DataFileNotFound | ||
>(new GetDataFile { DataFileId = Id, Owner = owner }, cancellationToken); | ||
if (response.Is(out Response<DataFileResult>? result)) | ||
{ | ||
_filename = result.Message.Filename; | ||
} | ||
else | ||
{ | ||
throw new InvalidOperationException($"The data file {Id} cannot be found."); | ||
Check failure on line 27 in src/Serval/src/Serval.Shared/Models/CorpusFile.cs GitHub Actions / NUnit TestsServal.Translation.Services.EngineServiceTests ► StartBuildAsync_MixedSourceAndTarget_ParallelCorpus
Raw output
Check failure on line 27 in src/Serval/src/Serval.Shared/Models/CorpusFile.cs GitHub Actions / NUnit TestsServal.Translation.Services.EngineServiceTests ► StartBuildAsync_NoFilters_ParallelCorpus
Raw output
Check failure on line 27 in src/Serval/src/Serval.Shared/Models/CorpusFile.cs GitHub Actions / NUnit TestsServal.Translation.Services.EngineServiceTests ► StartBuildAsync_NoTargetFilter_ParallelCorpus
Raw output
Check failure on line 27 in src/Serval/src/Serval.Shared/Models/CorpusFile.cs GitHub Actions / NUnit TestsServal.Translation.Services.EngineServiceTests ► StartBuildAsync_OneOfMultipleCorpora
Raw output
Check failure on line 27 in src/Serval/src/Serval.Shared/Models/CorpusFile.cs GitHub Actions / NUnit TestsServal.Translation.Services.EngineServiceTests ► StartBuildAsync_ParallelCorpus_OneOfMultipleCorpora
Raw output
Check failure on line 27 in src/Serval/src/Serval.Shared/Models/CorpusFile.cs GitHub Actions / NUnit TestsServal.Translation.Services.EngineServiceTests ► StartBuildAsync_ParallelCorpus_TextFiles
Raw output
Check failure on line 27 in src/Serval/src/Serval.Shared/Models/CorpusFile.cs GitHub Actions / NUnit TestsServal.Translation.Services.EngineServiceTests ► StartBuildAsync_ParallelCorpus_TrainOnOnePretranslateTheOther
Raw output
Check failure on line 27 in src/Serval/src/Serval.Shared/Models/CorpusFile.cs GitHub Actions / NUnit TestsServal.Translation.Services.EngineServiceTests ► StartBuildAsync_ScriptureRange_ParallelCorpus
Raw output
Check failure on line 27 in src/Serval/src/Serval.Shared/Models/CorpusFile.cs GitHub Actions / NUnit TestsServal.Translation.Services.EngineServiceTests ► StartBuildAsync_ScriptureRangeEmptyString
Raw output
Check failure on line 27 in src/Serval/src/Serval.Shared/Models/CorpusFile.cs GitHub Actions / NUnit TestsServal.Translation.Services.EngineServiceTests ► StartBuildAsync_ScriptureRangeSpecified
Raw output
|
||
} | ||
} | ||
|
||
public void SetFilename(string filename) | ||
{ | ||
_filename = filename; | ||
} | ||
|
||
public string GetFilename() | ||
{ | ||
return _filename | ||
?? throw new InvalidOperationException( | ||
"The filename has not been populated. It is not stored in the database." | ||
); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
namespace Serval.Shared.Models; | ||
|
||
public record MonolingualCorpus | ||
{ | ||
public required string Id { get; set; } | ||
public string? Name { get; set; } | ||
public required string Language { get; set; } | ||
public required IReadOnlyList<CorpusFile> Files { get; set; } | ||
|
||
public async Task PopulateFilenamesAsync( | ||
IRequestClient<GetDataFile> getDataFileClient, | ||
string owner, | ||
CancellationToken cancellationToken | ||
) | ||
{ | ||
await Task.WhenAll( | ||
Files.Select(file => file.PopulateFilenameAsync(getDataFileClient, owner, cancellationToken)) | ||
); | ||
} | ||
} |
This file was deleted.