7
7
#include < vector>
8
8
#include < string>
9
9
#include " char_property.h"
10
+ #include " common.h"
10
11
#include " connector.h"
11
12
#include " dictionary.h"
12
13
#include " dictionary_rewriter.h"
20
21
21
22
namespace MeCab {
22
23
24
+ bool quiet_mode = false ;
25
+
23
26
class DictionaryComplier {
24
27
public:
25
28
static int run (int argc, char **argv) {
@@ -48,6 +51,7 @@ class DictionaryComplier {
48
51
{ " posid" , ' p' , 0 , 0 , " assign Part-of-speech id" },
49
52
{ " node-format" , ' F' , 0 , " STR" ,
50
53
" use STR as the user defined node format" },
54
+ { " quiet" , ' q' , 0 , 0 , " don't print progress" },
51
55
{ " version" , ' v' , 0 , 0 , " show the version and exit." },
52
56
{ " help" , ' h' , 0 , 0 , " show this help and exit." },
53
57
{ 0 , 0 , 0 , 0 }
@@ -74,8 +78,11 @@ class DictionaryComplier {
74
78
bool opt_model = param.get <bool >(" build-model" );
75
79
bool opt_assign_user_dictionary_costs = param.get <bool >
76
80
(" assign-user-dictionary-costs" );
81
+ bool opt_quiet = param.get <bool >(" quiet" );
77
82
const std::string userdic = param.get <std::string>(" userdic" );
78
83
84
+ MeCab::quiet_mode = opt_quiet;
85
+
79
86
#define DCONF (file ) create_filename(dicdir, std::string(file)).c_str()
80
87
#define OCONF (file ) create_filename(outdir, std::string(file)).c_str()
81
88
@@ -124,8 +131,10 @@ class DictionaryComplier {
124
131
DCONF (MODEL_DEF_FILE),
125
132
OCONF (MODEL_FILE));
126
133
} else {
127
- std::cout << DCONF (MODEL_DEF_FILE)
128
- << " is not found. skipped." << std::endl;
134
+ if (!opt_quiet) {
135
+ std::cout << DCONF (MODEL_DEF_FILE)
136
+ << " is not found. skipped." << std::endl;
137
+ }
129
138
}
130
139
}
131
140
@@ -141,7 +150,9 @@ class DictionaryComplier {
141
150
}
142
151
}
143
152
144
- std::cout << " \n done!\n " ;
153
+ if (!opt_quiet) {
154
+ std::cout << " \n done!\n " ;
155
+ }
145
156
146
157
return 0 ;
147
158
}
0 commit comments