mirror of
https://github.com/Relintai/pmlpp.git
synced 2024-12-22 15:06:47 +01:00
Fixed crash.
This commit is contained in:
parent
4ec4e5cb7d
commit
acc4e4d14d
@ -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]);
|
||||
|
@ -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]);
|
||||
|
Loading…
Reference in New Issue
Block a user