Skip to content
Snippets Groups Projects
Commit 2954c0ac authored by ilor's avatar ilor
Browse files

figured out a better way to handle chunks in cclwriter, should be better now

parent a20fbd21
No related branches found
No related tags found
No related merge requests found
...@@ -21,6 +21,15 @@ CclWriter::~CclWriter() ...@@ -21,6 +21,15 @@ CclWriter::~CclWriter()
} }
void CclWriter::write_sentence(const Sentence& s) void CclWriter::write_sentence(const Sentence& s)
{
paragraph_head();
if (use_indent_) indent_more();
write_sentence_int(s);
if (use_indent_) indent_less();
osi() << "</chunk>\n";
}
void CclWriter::write_sentence_int(const Sentence &s)
{ {
const AnnotatedSentence* ann = dynamic_cast<const AnnotatedSentence*>(&s); const AnnotatedSentence* ann = dynamic_cast<const AnnotatedSentence*>(&s);
osi() << "<sentence>\n"; osi() << "<sentence>\n";
...@@ -46,8 +55,7 @@ void CclWriter::write_sentence(const Sentence& s) ...@@ -46,8 +55,7 @@ void CclWriter::write_sentence(const Sentence& s)
XmlWriter::write_token(*t); XmlWriter::write_token(*t);
} }
} }
if (use_indent_) indent_less(); if (use_indent_) indent_less(); osi() << "</sentence>\n";
osi() << "</sentence>\n";
} }
void CclWriter::write_chunk(const Chunk &c) void CclWriter::write_chunk(const Chunk &c)
...@@ -55,7 +63,7 @@ void CclWriter::write_chunk(const Chunk &c) ...@@ -55,7 +63,7 @@ void CclWriter::write_chunk(const Chunk &c)
paragraph_head(c); paragraph_head(c);
if (use_indent_) indent_more(); if (use_indent_) indent_more();
foreach (const Sentence::ConstPtr& s, c.sentences()) { foreach (const Sentence::ConstPtr& s, c.sentences()) {
write_sentence(*s); write_sentence_int(*s);
} }
if (use_indent_) indent_less(); if (use_indent_) indent_less();
osi() << "</chunk>\n"; osi() << "</chunk>\n";
......
...@@ -20,6 +20,8 @@ public: ...@@ -20,6 +20,8 @@ public:
static bool registered; static bool registered;
protected: protected:
void write_sentence_int(const Sentence &s);
void do_header(); void do_header();
void do_footer(); void do_footer();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment