35 static char *cfg_pathTxt = NULL;
39 static int cfg_nClassNum = 10;
40 static bool cfg_bSimpleCluster =
false;
44 static char *cfg_pathReadRes = NULL;
45 static char *cfg_pathWriteRes = NULL;
51 opt.
Add(
wbOPT_STRING,
"txt", &cfg_pathTxt,
"input txt(word id, begin from 0)");
57 opt.
Add(
wbOPT_STRING,
"read", &cfg_pathReadRes,
"read the res file [word-id, class-id]");
58 opt.
Add(
wbOPT_STRING,
"write", &cfg_pathWriteRes,
"write the res file [word-id, class-id]");
61 opt.
Add(
wbOPT_TRUE,
"simple-cluster", &cfg_bSimpleCluster,
"just using the count of unigram to perform cluster");
62 opt.
Parse(_argc, _argv);
66 lout <<
"[OMP] omp_thread = " << omp_get_max_threads() << endl;
73 cluster.
InitCount(cfg_pathTxt, cfg_pathReadRes);
76 if (cfg_bSimpleCluster) {
77 lout <<
"Simple Cluster..." << endl;
81 lout <<
"Cluster..." << endl;
void SimpleCluster()
使用出现频率进行简单的分类,不需要迭代
void Parse(const char *plabel, const char *pvalue)
parse a single option, "pvalue" can be NULL
void InitCount(const char *path, const char *path_init_res=NULL)
void WriteRes(const char *path)
void Add(ValueType t, const char *pLabel, void *pAddress, const char *pDocMsg=NULL)
Add a option.
Log lout
the defination is in wb-log.cpp
define all the code written by Bin Wang.
Get the option from command line or command files.
void Cluster(int nMaxTime=-1)
cluster