如何禁用或静音如下所示的Apache OpenNLP日志:
Performing 100 iterations.
1: .. loglikelihood=-3384.6376826743144 0.38951464263772273
2: .. loglikelihood=-2191.9266688597672 0.9397911120212984
3: .. loglikelihood=-1645.8640771555981 0.9643661683391358
4: .. loglikelihood=-1340.386303774519 0.9739913987302887
5: .. loglikelihood=-1148.4141548519624 0.9748105672742167
...<skipping a bunch of iterations>...
95: .. loglikelihood=-288.25556805874436 0.9834118369854598
96: .. loglikelihood=-287.2283680343481 0.9834118369854598
97: .. loglikelihood=-286.2174830344526 0.9834118369854598
98: .. loglikelihood=-285.222486981048 0.9834118369854598
99: .. loglikelihood=-284.24296917223916 0.9834118369854598
100: .. loglikelihood=-283.2785335773966 0.9834118369854598
更新:我需要在Java代码中执行此操作。
最佳答案
您可以在培训期间通过设置属性PrintMessages = false来使Apache OpenNLP日志静音,该属性通过-params选项设置为默认值。该属性应在属性文件中提供:
$ cat params.props
PrintMessages=false
然后开始训练:
$ opennlp TokenNameFinderTrainer -lang en -data en-ner.train -model en-ner.bin -params params.props