diff --git a/.gitignore b/.gitignore index d60b6215..c0a2807d 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ Release/ *.nupkg .vs/ .vscode/ +.idea/ build*/ artifacts/ diff --git a/src/shared_library/thot.cc b/src/shared_library/thot.cc index d8029f21..b4da90f3 100644 --- a/src/shared_library/thot.cc +++ b/src/shared_library/thot.cc @@ -1092,6 +1092,17 @@ extern "C" { auto alignmentModel = static_cast(swAlignModelHandle); + if (matrix == nullptr) + { + // Retrieve the dimensions of the training alignment matrix for sentence pair n + Count c; + std::vector srcSentence, trgSentence; + alignmentModel->getSentencePair(n, srcSentence, trgSentence, c); + *iLen = (unsigned int)srcSentence.size(); + *jLen = (unsigned int)trgSentence.size(); + return SMALL_LG_NUM; + } + WordAlignmentMatrix waMatrix; LgProb prob = alignmentModel->getTrainingAlignment(n, waMatrix); // A filtered/out-of-range pair yields an empty matrix, so clamp to its actual