Skip to content

Commit b04052f

Browse files
committed
Use correct matrix dimensions for getTrainingAlignment
1 parent cc6f0db commit b04052f

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/SIL.Machine.Translation.Thot/SIL.Machine.Translation.Thot.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<Import Project="../AssemblyInfo.props" />
1313

1414
<ItemGroup>
15-
<PackageReference Include="Thot" Version="3.5.1" />
15+
<PackageReference Include="Thot" Version="3.5.2" />
1616
</ItemGroup>
1717

1818
<ItemGroup>

src/SIL.Machine.Translation.Thot/ThotWordAlignmentModel.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,12 @@ public void Save()
166166
public WordAlignmentMatrix GetTrainingAlignment(int n)
167167
{
168168
CheckDisposed();
169-
IntPtr nativeMatrix = Thot.AllocNativeMatrix(_sourceWords.Count, _targetWords.Count);
170169

171-
uint iLen = (uint)_sourceWords.Count;
172-
uint jLen = (uint)_targetWords.Count;
170+
uint iLen = 0;
171+
uint jLen = 0;
172+
Thot.swAlignModel_getTrainingAlignment(Handle, (uint)n, IntPtr.Zero, ref iLen, ref jLen);
173+
174+
IntPtr nativeMatrix = Thot.AllocNativeMatrix((int)iLen, (int)jLen);
173175
try
174176
{
175177
Thot.swAlignModel_getTrainingAlignment(Handle, (uint)n, nativeMatrix, ref iLen, ref jLen);

0 commit comments

Comments
 (0)