commit 292d2c908617d309cada49c4001cafd0402cc7db Author: aboelhamd Date: Fri Jun 28 15:31:32 2019 +0200 remove unused methods diff --git a/src/CLExec.cpp b/src/CLExec.cpp index eb0628c..29ae6cb 100644 --- a/src/CLExec.cpp +++ b/src/CLExec.cpp @@ -33,120 +33,6 @@ using namespace std; using namespace pugi; using namespace elem; -string exec(string cmd) { - string data; - FILE * stream; - const int max_buffer = 256; - char buffer[max_buffer]; - - stream = popen(cmd.c_str(), "r"); - if (stream) { - while (!feof(stream)) - if (fgets(buffer, max_buffer, stream) != NULL) - data.append(buffer); - pclose(stream); - } - return data; -} - -void CLExec::segmenter(string inFilePath, string outFilePath) { - // clear file before writing again - ofstream ofs; - ofs.open(outFilePath.c_str(), ofstream::out | ofstream::trunc); - exec( - string("ruby2.3 kazSentenceTokenizer.rb ") + inFilePath - + string(" ") + outFilePath); -} - -void CLExec::biltrans(string inFilePath, string outFilePath) { - // clear file before writing again - ofstream ofs; - ofs.open(outFilePath.c_str(), ofstream::out | ofstream::trunc); - exec( - string("apertium -d $HOME/apertium-kaz-tur kaz-tur-biltrans ") - + inFilePath + string(" ") + outFilePath); -} - -void CLExec::lextor(string inFilePath, string outFilePath) { - // clear file before writing again - ofstream ofs; - ofs.open(outFilePath.c_str(), ofstream::out | ofstream::trunc); - exec( - string("lrx-proc -m $HOME/apertium-kaz-tur/kaz-tur.autolex.bin ") - + inFilePath + string(" >") + outFilePath); -} - -void CLExec::interchunk(string inFilePath, string outFilePath) { - exec( - string("apertium-interchunk") - + string( - " $HOME/apertium-kaz-tur/apertium-kaz-tur.kaz-tur.t2x") - + string(" $HOME/apertium-kaz-tur/kaz-tur.t2x.bin ") - + inFilePath + string(" ") + outFilePath); -} - -void CLExec::postchunk(string inFilePath, string outFilePath) { - exec( - string("apertium-postchunk") - + string( - " $HOME/apertium-kaz-tur/apertium-kaz-tur.kaz-tur.t3x") - + string(" $HOME/apertium-kaz-tur/kaz-tur.t3x.bin ") - + inFilePath + string(" ") + outFilePath); -} - -void CLExec::transfer(string inFilePath, string outFilePath) { - exec( - string("apertium-transfer -n") - + string( - " $HOME/apertium-kaz-tur/apertium-kaz-tur.kaz-tur.t4x") - + string(" $HOME/apertium-kaz-tur/kaz-tur.t4x.bin ") - + inFilePath - + string( - " | lt-proc -g $HOME/apertium-kaz-tur/kaz-tur.autogen.bin") - + string( - " | lt-proc -p $HOME/apertium-kaz-tur/kaz-tur.autopgen.bin") - + string(" >") + outFilePath); -} - -void CLExec::assignWeights(string inFilePath, string outFilePath) { - exec( - (string("python3 $HOME/NormaliseK/exampleken.py <") - + string(inFilePath) + string(">") + string(outFilePath)).c_str()); -} - -vector CLExec::getFilesInDir(string dir) { - vector files; - - DIR *pDIR; - struct dirent *entry; - if ((pDIR = opendir((string("./") + dir).c_str()))) { - while ((entry = readdir(pDIR))) { - if (strcmp(entry->d_name, ".") != 0 - && strcmp(entry->d_name, "..") != 0) { - files.push_back(entry->d_name); - } - } - closedir(pDIR); - } - - return files; -} - -//void -//CLExec::runYasmet () -//{ -// vector datasets = getFilesInDir (DATASETS); -// -// for (unsigned i = 0; i < datasets.size (); i++) -// { -// string dataset = datasets[i]; -// -// exec ( -// (string ("./yasmet <") + DATASETS + string ("/") + dataset + string (">") -// + MODELS + string ("/") + dataset + string (".model")).c_str ()); -// } -//} - map > > CLExec::loadYasmetModels( string modelsFilePath/*, string *localeid*/) { // map with key yasmet model name and the value is