Skip to content

Commit

Permalink
Merge pull request #1382 from Clear-Bible/808-verse-refresh
Browse files Browse the repository at this point in the history
Token Splitting - project corruption
  • Loading branch information
morleycb authored Jul 18, 2024
2 parents fb16d1a + 72fd904 commit 07f5a70
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AssemblyVersion>1.5.0.0</AssemblyVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ClearBible.Engine" Version="3.0.6" />
<PackageReference Include="ClearBible.Engine" Version="3.0.9" />
<PackageReference Include="LibGit2Sharp" Version="0.27.2" />
<PackageReference Include="MediatR" Version="9.0.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Caliburn.Micro.Core" Version="4.0.212" />
<PackageReference Include="ClearBible.Engine" Version="3.0.6" />
<PackageReference Include="ClearBible.Engine" Version="3.0.9" />
<PackageReference Include="MediatR" Version="9.0.0" />
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,13 @@ CancellationToken cancellationToken
{
tokensHavingSubwordsToRenumberDb[i].OriginTokenLocation ??= tokenDb.OriginTokenLocation ?? tokenDb.EngineTokenId;
tokensHavingSubwordsToRenumberDb[i].SubwordNumber = nextSubwordNumber + i;
tokensHavingSubwordsToRenumberDb[i].EngineTokenId = (new TokenId(
tokenDb.BookNumber,
tokenDb.ChapterNumber,
tokenDb.VerseNumber,
tokenDb.WordNumber,
tokensHavingSubwordsToRenumberDb[i].SubwordNumber)
).ToString();

splitTokenDbCommands.AddTokenToSubwordRenumber(tokensHavingSubwordsToRenumberDb[i]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ public static async Task UpdateTypeTokenComponentAsync(Models.TokenComponent tok
public static DbCommand CreateTokenSubwordRenumberCommand(DbConnection connection)
{
var command = connection.CreateCommand();
var columns = new string[] { nameof(Models.Token.OriginTokenLocation), nameof(Models.Token.SubwordNumber) };
var columns = new string[] { nameof(Models.Token.OriginTokenLocation), nameof(Models.Token.SubwordNumber), nameof(Models.Token.EngineTokenId) };
var whereColumns = new (string, WhereEquality)[] { (nameof(Models.IdentifiableEntity.Id), WhereEquality.Equals) };

DataUtil.ApplyColumnsToUpdateCommand(
Expand All @@ -480,6 +480,7 @@ public static async Task SubwordRenumberTokenAsync(DataAccessLayer.Models.Token
{
command.Parameters[$"@{nameof(Models.Token.OriginTokenLocation)}"].Value = token.OriginTokenLocation;
command.Parameters[$"@{nameof(Models.Token.SubwordNumber)}"].Value = token.SubwordNumber;
command.Parameters[$"@{nameof(Models.Token.EngineTokenId)}"].Value = token.EngineTokenId;
command.Parameters[$"@{nameof(Models.IdentifiableEntity.Id)}"].Value = token.Id;

_ = await command.ExecuteNonQueryAsync(cancellationToken).ConfigureAwait(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,22 @@ public async Task SplitToken(TokenizedTextCorpus corpus,
}
}


/// <summary>
/// Split tokens in a <see cref="TokenizedTextCorpus"/> according to the provided <see cref="SplitInstructions"/>.
/// </summary>
/// <param name="corpus"></param>
/// <param name="tokenId"></param>
/// <param name="splitInstructions"></param>
/// <param name="createParallelComposite"></param>
/// <param name="propagateTo"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <remarks>Only dealing with non-parallel composites for now. Will need to deal with reconciliation of tokens in the parallel composite case in the future.</remarks>
public async Task<(IDictionary<TokenId, IEnumerable<CompositeToken>> SplitCompositeTokensByIncomingTokenId, IDictionary<TokenId, IEnumerable<Token>> SplitChildTokensByIncomingTokenId)> SplitTokensAsync(TokenizedTextCorpus corpus,
TokenId tokenId,
SplitInstructions splitInstructions,
bool createParallelComposite = true,
bool createParallelComposite = false,
SplitTokenPropagationScope propagateTo = SplitTokenPropagationScope.None,
CancellationToken cancellationToken = default)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
<PackageReference Include="Autofac.Configuration" Version="6.0.0" />
<PackageReference Include="CefSharp.Wpf.NETCore" Version="115.3.110" />
<PackageReference Include="ClearApplicationFoundation" Version="3.0.0" />
<PackageReference Include="ClearBible.Engine" Version="3.0.6" />
<PackageReference Include="ClearBible.Engine" Version="3.0.9" />
<PackageReference Include="Dahomey.Json" Version="1.12.2" />
<PackageReference Include="Dahomey.Json.Attributes" Version="1.0.1" />
<PackageReference Include="Dirkster.AvalonDock" Version="4.70.12" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<ItemGroup>
<PackageReference Include="Autofac" Version="8.0.0" />
<PackageReference Include="Autofac.Configuration" Version="6.0.0" />
<PackageReference Include="ClearBible.Engine" Version="3.0.6" />
<PackageReference Include="ClearBible.Engine" Version="3.0.9" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageReference Include="Serilog.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
Expand Down

0 comments on commit 07f5a70

Please sign in to comment.