From 1771a56cca005a550c8cd4f395efff8ff3b80829 Mon Sep 17 00:00:00 2001 From: Adam Radziszewski <adam.radziszewski@pwr.wroc.pl> Date: Fri, 27 Jan 2012 15:11:50 +0100 Subject: [PATCH] prevent whole doc reader from reporting 'unexpected' rel XML tags --- libcorpus2/io/cclreader.cpp | 10 +++++++--- libcorpus2_whole/io/documentreader.cpp | 4 ++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/libcorpus2/io/cclreader.cpp b/libcorpus2/io/cclreader.cpp index 34094a8..97b066f 100644 --- a/libcorpus2/io/cclreader.cpp +++ b/libcorpus2/io/cclreader.cpp @@ -309,6 +309,8 @@ void CclReader::set_option(const std::string& option) impl_->set_autogen_sent_id(true); } else if (option == "autogen_chunk_id") { impl_->set_autogen_chunk_id(true); + } else if (option == "no_warn_unexpected_xml") { + impl_->set_warn_on_unexpected(false); } else { BufferedChunkReader::set_option(option); @@ -320,11 +322,13 @@ std::string CclReader::get_option(const std::string& option) const if (option == "disamb_only") { return impl_->get_disamb_only() ? option : ""; } else if (option == "no_warn_inconsistent") { - return impl_->get_warn_on_inconsistent() ? option : ""; + return impl_->get_warn_on_inconsistent() ? "" : option; } else if (option == "autogen_sent_id") { - return impl_->get_autogen_sent_id() ? "autogen_sent_id" : ""; + return impl_->get_autogen_sent_id() ? option : ""; } else if (option == "autogen_chunk_id") { - return impl_->get_autogen_chunk_id() ? "autogen_chunk_id" : ""; + return impl_->get_autogen_chunk_id() ? option : ""; + } else if (option == "no_warn_unexpected_xml") { + return impl_->get_warn_on_unexpected() ? "" : option; } return BufferedChunkReader::get_option(option); } diff --git a/libcorpus2_whole/io/documentreader.cpp b/libcorpus2_whole/io/documentreader.cpp index 8aa1a79..c30a4fb 100644 --- a/libcorpus2_whole/io/documentreader.cpp +++ b/libcorpus2_whole/io/documentreader.cpp @@ -31,6 +31,10 @@ namespace whole { const std::string &annot_path, const std::string &rela_path) { ccl_reader_ = boost::make_shared<CclReader>(tagset, annot_path); + // prevent the underlying CCL reader from complaining about + // relation XML tags unknown to the reader itself + // (in case annot_path and rela_path poin to the same file) + ccl_reader_->set_option("no_warn_unexpected_xml"); rel_reader_ = boost::make_shared<RelationReader>(rela_path); } -- GitLab