diff --git a/mecab/src/tagger.cpp b/mecab/src/tagger.cpp index 2780dbb..8aa4fef 100644 --- a/mecab/src/tagger.cpp +++ b/mecab/src/tagger.cpp @@ -49,9 +49,9 @@ const MeCab::Option long_options[] = { "output marginal probability (default false)" }, { "max-grouping-size", 'M', "24", "INT", "maximum grouping size for unknown words (default 24)" }, - { "node-format", 'F', "%m\\t%H\\n", "STR", + { "node-format", 'F', "", "STR", "use STR as the user-defined node format" }, - { "unk-format", 'U', "%m\\t%H\\n", "STR", + { "unk-format", 'U', "", "STR", "use STR as the user-defined unknown node format" }, { "bos-format", 'B', "", "STR", "use STR as the user-defined beginning-of-sentence format" }, diff --git a/mecab/src/writer.cpp b/mecab/src/writer.cpp index ed68767..592294a 100644 --- a/mecab/src/writer.cpp +++ b/mecab/src/writer.cpp @@ -23,7 +23,8 @@ void Writer::close() { } bool Writer::open(const Param ¶m) { - const std::string ostyle = param.get("output-format-type"); + const std::string node_format_option = param.get("node-format"); + const std::string ostyle = node_format_option.empty() ? param.get("output-format-type") : ""; write_ = &Writer::writeLattice; if (ostyle == "wakati") { @@ -77,7 +78,8 @@ bool Writer::open(const Param ¶m) { if (node_format != node_format2 || bos_format != bos_format2 || eos_format != eos_format2 || unk_format != unk_format2) { write_ = &Writer::writeUser; - if (node_format != node_format2) { + + if (!node_format2.empty() && node_format != node_format2) { node_format = node_format2; } if (bos_format != bos_format2) { @@ -86,9 +88,9 @@ bool Writer::open(const Param ¶m) { if (eos_format != eos_format2) { eos_format = eos_format2; } - if (unk_format != unk_format2) { + if (!unk_format2.empty() && unk_format != unk_format2) { unk_format = unk_format2; - } else if (node_format != node_format2) { + } else if (!node_format2.empty() && node_format != node_format2) { unk_format = node_format2; } else { unk_format = node_format;