ITeye博客

hack the stanford postagger demo

turingfellow · 2010-03-20 10:18 · postagger · 编程语言 · Markdown

stanford postagger 的demo默认情况下输出slashtags。在代码中如何修改,才能让它输出xml? 在MaxentTagger.java文件中,修改public String apply(String o)代码 public String apply(String o) { StringBuilder taggedSentence = new StringBuilder(); int outputStyle; boolean tokenize; if (config != null) { outputStyle = PlainTextDocumentReaderAndWriter.asIntOutputFormat(config.getOutputFormat()); tokenize = config.getTokenize(); } else { // outputStyle = PlainTextDocumentReaderAndWriter.OUTPUT_STYLE_SLASH_TAGS; outputStyle = PlainTextDocumentReaderAndWriter.OUTPUT_STYLE_XML;//change the default tag style to xml tokenize = true; } 修改后的运行结果: Butterfly , you are mine .

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。