Fixed crash.

This commit is contained in:
Relintai 2023-12-28 15:09:55 +01:00
parent 4ec4e5cb7d
commit acc4e4d14d
2 changed files with 8 additions and 4 deletions

View File

@ -1086,10 +1086,12 @@ MLPPData::WordsToVecResult MLPPData::word_to_vec(std::vector<std::string> senten
for (uint32_t i = 0; i < segmented_sentences.size(); i++) {
for (uint32_t j = 0; j < segmented_sentences[i].size(); j++) {
for (int k = windowSize; k > 0; k--) {
if (j - k >= 0) {
int jmk = (int)j - k;
if (jmk >= 0) {
inputStrings.push_back(segmented_sentences[i][j]);
outputStrings.push_back(segmented_sentences[i][j - k]);
outputStrings.push_back(segmented_sentences[i][jmk]);
}
if (j + k <= segmented_sentences[i].size() - 1) {
inputStrings.push_back(segmented_sentences[i][j]);

View File

@ -597,10 +597,12 @@ std::tuple<std::vector<std::vector<real_t>>, std::vector<std::string>> MLPPDataO
for (uint32_t i = 0; i < segmented_sentences.size(); i++) {
for (uint32_t j = 0; j < segmented_sentences[i].size(); j++) {
for (int k = windowSize; k > 0; k--) {
if (j - k >= 0) {
int jmk = (int)j - k;
if (jmk >= 0) {
inputStrings.push_back(segmented_sentences[i][j]);
outputStrings.push_back(segmented_sentences[i][j - k]);
outputStrings.push_back(segmented_sentences[i][jmk]);
}
if (j + k <= segmented_sentences[i].size() - 1) {
inputStrings.push_back(segmented_sentences[i][j]);