From 86e577667557a5f9b470628762969d22a07c8159 Mon Sep 17 00:00:00 2001
From: Adam Radziszewski <adam.radziszewski@pwr.wroc.pl>
Date: Sat, 15 Jun 2013 13:45:33 +0200
Subject: [PATCH] fix spaces in line writer

---
 libcorpus2/io/linewriter.cpp | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/libcorpus2/io/linewriter.cpp b/libcorpus2/io/linewriter.cpp
index deb8650..bd5a7c5 100644
--- a/libcorpus2/io/linewriter.cpp
+++ b/libcorpus2/io/linewriter.cpp
@@ -75,19 +75,17 @@ void LineWriter::write_sentence(const Sentence& s)
 			// use IOB2 representation internally
 			AnnotationChannel &chan = hax->get_channel(vt.first);
 			chan.make_iob_from_segments();
-			IOB::Enum last_tag = IOB::O;
 			// write line representation
 			for (int idx = 0; idx < chan.size(); idx++) {
 				IOB::Enum this_tag = chan.get_iob_at(idx);
-				if (last_tag == IOB::O || this_tag == IOB::O) {
-					os() << " ";
+				if (this_tag == IOB::I) {
+					os() << chunk_char;
 				}
 				else {
-					os() << chunk_char;
+					os() << empty_char;
 				}
-				last_tag = chan.get_iob_at(idx);
-				std::string now(" ");
-				if (last_tag != IOB::O) {
+				std::string now(empty_char);
+				if (this_tag != IOB::O) {
 					if (chan.is_head_at(idx)) {
 						now = head_char;
 					}
@@ -98,7 +96,6 @@ void LineWriter::write_sentence(const Sentence& s)
 				for (int line_pos = orth_lens[idx]; line_pos > 0; line_pos--) {
 					os() << now;
 				}
-				last_tag = this_tag;
 			}
 			os() << "\n";
 		}
-- 
GitLab