diff --git a/mlpp/data/data.cpp b/mlpp/data/data.cpp index 2ccac6e..efc330e 100644 --- a/mlpp/data/data.cpp +++ b/mlpp/data/data.cpp @@ -1086,10 +1086,12 @@ MLPPData::WordsToVecResult MLPPData::word_to_vec(std::vector 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]); diff --git a/mlpp/data/data_old.cpp b/mlpp/data/data_old.cpp index 2fec574..488fc13 100644 --- a/mlpp/data/data_old.cpp +++ b/mlpp/data/data_old.cpp @@ -597,10 +597,12 @@ std::tuple>, std::vector> 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]);