Commit 3a1dcc84 authored by Grzegorz Kostkowski's avatar Grzegorz Kostkowski

Add possibility to set custom annotation name

parent 91bc7855
......@@ -11,17 +11,20 @@ typedef boost::shared_ptr<MWEReader> MWEReaderPtr;
CclMWEReader::CclMWEReader(const std::string &doc_path, const Tagset &tagset,
std::string mwe_file) : BaseRelReader("document"), annotate(true)
std::string mwe_file, std::string ann_chan_name)
: BaseRelReader("document"), annotate(true)
{
make_readers(tagset, doc_path);
BaseRelReader::make_id_doc(doc_path, doc_path);
if (mwe_file == "")
mwe_file = get_mwe_dict("mwe");
init_mwes(mwe_file);
if (ann_chan_name != "")
set_annotation_channel(ann_chan_name);
}
CclMWEReader::CclMWEReader(const std::string &doc_path, const std::string &rel_path,
const Tagset &tagset, std::string mwe_file)
const Tagset &tagset, std::string mwe_file, std::string ann_chan_name)
: BaseRelReader("document"), annotate(true)
{
make_readers(tagset, doc_path, rel_path);
......@@ -29,6 +32,8 @@ CclMWEReader::CclMWEReader(const std::string &doc_path, const std::string &rel_p
if (mwe_file == "")
mwe_file = get_mwe_dict("mwe");
init_mwes(mwe_file);
if (ann_chan_name != "")
set_annotation_channel(ann_chan_name);
}
void CclMWEReader::use_annotations(bool val) {
......@@ -61,6 +66,11 @@ void CclMWEReader::set_files(const std::string &doc_path,
BaseRelReader::make_id_doc(doc_path, rel_path);
}
void CclMWEReader::set_annotation_channel(const std::string &chan_name)
{
boost::static_pointer_cast<MWEReader>(reader_)->set_annotation_channel(chan_name);
}
void CclMWEReader::init_mwes(const std::string &mwe_file) {
if (reader_) {
reader_->set_option("inner:ccl");
......
......@@ -19,18 +19,20 @@ namespace Corpus2MWE {
typedef boost::shared_ptr<TokenReader> TokenReaderPtr;
CclMWEReader(const std::string &doc_path, const Tagset &tagset,
std::string mwe_file="");
std::string mwe_file="", std::string ann_chan_name="");
CclMWEReader(const std::string &doc_path, const std::string &rel_path,
const Tagset &tagset, std::string mwe_file="");
const Tagset &tagset, std::string mwe_file="",
std::string ann_chan_name="");
/** set new file to read */
void set_files(const std::string &doc_path);
void set_files(const std::string &doc_path, const std::string &rel_path);
void use_annotations(bool annots_used);
/// set name of annotation to add for found mwe / terms
void set_annotation_channel(const std::string &chan_name);
/** get the reader object */
TokenReaderPtr reader();
TokenReaderPtr reader();
private:
/**
......
......@@ -24,10 +24,11 @@ namespace Corpus2MWE {
typedef boost::shared_ptr<Corpus2::TokenReader> TokenReaderPtr;
CclMWEReader(const std::string &doc_path, const std::string &rel_path,
const Corpus2::Tagset & tagset, std::string mwe_file="");
const Corpus2::Tagset & tagset, std::string mwe_file="",
std::string ann_chan_name="");
CclMWEReader(const std::string &doc_path, const Corpus2::Tagset & tagset,
std::string mwe_file="");
std::string mwe_file="", std::string ann_chan_name="");
boost::shared_ptr<Corpus2::whole::Document> read();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment