Skip to content
Snippets Groups Projects
Commit b6b6351e authored by Paweł Kędzia's avatar Paweł Kędzia
Browse files

Sentence id handling in cclreader/writer

parent 6257e56e
No related branches found
No related tags found
No related merge requests found
......@@ -140,9 +140,18 @@ void CclReaderImpl::start_chunk(const AttributeList& attributes)
void CclReaderImpl::start_sentence(const AttributeList& /*attributes*/)
void CclReaderImpl::start_sentence(const AttributeList &attributes)
{
ann_sent_ = boost::make_shared<AnnotatedSentence>();
// find sentence id
std::string id = "";
foreach (const Attribute& a, attributes) {
if (a.name == "id") {
id = a.value;
break;
}
}
ann_sent_ = boost::make_shared<AnnotatedSentence>(id);
sent_ = ann_sent_;
state_ = STATE_SENTENCE;
}
......
......@@ -33,7 +33,15 @@ void CclWriter::write_sentence(const Sentence& s)
void CclWriter::write_sentence_int(const Sentence &s)
{
const AnnotatedSentence* ann = dynamic_cast<const AnnotatedSentence*>(&s);
std::string id = s.id();
if (id == "") {
osi() << "<sentence>\n";
}
else {
osi() << "<sentence id=\"" << id << "\">\n";
}
if (use_indent_) indent_more();
for (size_t idx = 0; idx < s.size(); ++idx) {
const Token* t = s.tokens()[idx];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment