textsplitko: start cmd as python kosplitter.py

This commit is contained in:
Jean-Francois Dockes 2020-04-10 14:34:50 +01:00
parent de246349da
commit ec7379f837

View File

@ -46,6 +46,7 @@ static const string sepchars("\t");
static CmdTalk *o_talker; static CmdTalk *o_talker;
static bool o_starterror{false}; static bool o_starterror{false};
static string o_cmdpath; static string o_cmdpath;
static vector<string> o_cmdargs;
std::mutex o_mutex; std::mutex o_mutex;
static string o_taggername{"Okt"}; static string o_taggername{"Okt"};
static bool isKomoran{false}; static bool isKomoran{false};
@ -58,7 +59,13 @@ static const string magicpage{"NEWPPPAGE"};
void TextSplit::koStaticConfInit(RclConfig *config, const string& tagger) void TextSplit::koStaticConfInit(RclConfig *config, const string& tagger)
{ {
#ifdef _WIN32
o_cmdpath = config->findFilter("python");
o_cmdargs.clear();
o_cmdargs.push_back(config->findFilter("kosplitter.py"));
#else
o_cmdpath = config->findFilter("kosplitter.py"); o_cmdpath = config->findFilter("kosplitter.py");
#endif
if (tagger == "Okt" || tagger == "Mecab" || tagger == "Komoran") { if (tagger == "Okt" || tagger == "Mecab" || tagger == "Komoran") {
o_taggername = tagger; o_taggername = tagger;
if (tagger == "Komoran") if (tagger == "Komoran")
@ -92,7 +99,7 @@ static bool initCmd()
o_starterror = true; o_starterror = true;
return false; return false;
} }
if (!o_talker->startCmd(o_cmdpath)) { if (!o_talker->startCmd(o_cmdpath, o_cmdargs)) {
delete o_talker; delete o_talker;
o_talker = nullptr; o_talker = nullptr;
o_starterror = true; o_starterror = true;