commit ae07773fe8830727a84913bd957599c63371203d Author: aboelhamd Date: Tue Jul 30 02:28:17 2019 +0200 add the deleting pointers code diff --git a/src/BeamSearch.cpp b/src/BeamSearch.cpp index b8b95ee..cd0449c 100644 --- a/src/BeamSearch.cpp +++ b/src/BeamSearch.cpp @@ -100,12 +100,12 @@ int main(int argc, char **argv) { stringstream buffer(k); buffer >> beam; -// unsigned i = 0; + // unsigned i = 0; string tokenizedSentence; while (getline(lextorFile, tokenizedSentence)) { -// cout << i << endl; + // cout << i << endl; -// spaces after each token + // spaces after each token vector spaces; // tokens in the sentence order @@ -175,6 +175,26 @@ int main(int argc, char **argv) { for (unsigned j = 0; j < outs.size(); j++) chunkerFile << outs[j] << endl; + // delete AmbigInfo pointers + for (unsigned j = 0; j < ambigInfo.size(); j++) { + // delete the dummy node pointers + set dummies; + for (unsigned k = 0; k < ambigInfo[j]->combinations.size(); k++) + dummies.insert(ambigInfo[j]->combinations[k][0]); + for (set::iterator it = dummies.begin(); + it != dummies.end(); it++) + delete (*it); + + delete ambigInfo[j]; + } + // delete Node pointers + for (map >::iterator it = + nodesPool.begin(); it != nodesPool.end(); it++) { + for (unsigned j = 0; j < it->second.size(); j++) { + delete it->second[j]; + } + } + } chunkerFile.close(); lextorFile.close(); diff --git a/src/GenSkData.cpp b/src/SklearnModel.cpp similarity index 100% rename from src/GenSkData.cpp rename to src/SklearnModel.cpp