如何在MATLAB中抑制Stanford CoreNLP Redwood日志记录? [英] How to suppress Stanford CoreNLP Redwood logging in MATLAB?
问题描述
线程如何关闭Stanford CoreNLP Redwood日志记录?用Java解决了我的问题.我想在MATLAB中执行相同的操作,但是该线程中给出的代码不起作用.请提出一个完整的解决方案,从导入内容,设置属性等开始.
The thread How to shutdown Stanford CoreNLP Redwood logging? supposedly resolved my question in Java. I would like to do the same in MATLAB, but the code(s) given in that thread doesn't work. Please suggest a complete solution, starting with what to import, setting properties, etc.
我的代码如下:
import java.io.*;
import edu.stanford.nlp.tagger.maxent.MaxentTagger;
tagger = MaxentTagger('./english-left3words-distsim.tagger');
登录命令行:
Reading POS tagger model from ./english-left3words-distsim.tagger ... done [3.6 sec].
来自我的包中的CreateTagger.m: https://github.com/jzsfvss/POSTaggerSML .
taken from CreateTagger.m in my package: https://github.com/jzsfvss/POSTaggerSML.
推荐答案
我不太想从MatLab调用Java,但是我认为它可以工作并删除加载消息以代替以下内容(其中最后一个false
参数说不打印加载):
I'm not very up on calling Java from MatLab, but I think it would work and remove the loading message to use instead the following (where the final false
argument says to not print loading):
import edu.stanford.nlp.util.StringUtils;
...
tagger = MaxentTagger('./english-left3words-distsim.tagger', StringUtils.argsToProperties({'-model', './english-left3words-distsim.tagger'}), false);
如果这不起作用,也许最简单的方法是用以下行制作一个slf4j配置文件simplelogger.properties
:
If that doesn't work, perhaps the easiest thing would be to make an slf4j config file simplelogger.properties
with the line:
org.slf4j.simpleLogger.log.edu.stanford.nlp.tagger.maxent.MaxentTagger=warn
,并确保该文件位于Java类路径上(可能调用了javaaddpath
),以便标记程序组件不再像加载文件一样打印INFO消息.
and to make sure that file is on the Java classpath (presumably with a call to javaaddpath
) so that the tagger component no longer prints INFO messages like the file loading.
这篇关于如何在MATLAB中抑制Stanford CoreNLP Redwood日志记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!