Skip to content
Snippets Groups Projects
Commit 86e57766 authored by Adam Radziszewski's avatar Adam Radziszewski
Browse files

fix spaces in line writer

parent 79f06f02
Branches
No related merge requests found
...@@ -75,19 +75,17 @@ void LineWriter::write_sentence(const Sentence& s) ...@@ -75,19 +75,17 @@ void LineWriter::write_sentence(const Sentence& s)
// use IOB2 representation internally // use IOB2 representation internally
AnnotationChannel &chan = hax->get_channel(vt.first); AnnotationChannel &chan = hax->get_channel(vt.first);
chan.make_iob_from_segments(); chan.make_iob_from_segments();
IOB::Enum last_tag = IOB::O;
// write line representation // write line representation
for (int idx = 0; idx < chan.size(); idx++) { for (int idx = 0; idx < chan.size(); idx++) {
IOB::Enum this_tag = chan.get_iob_at(idx); IOB::Enum this_tag = chan.get_iob_at(idx);
if (last_tag == IOB::O || this_tag == IOB::O) { if (this_tag == IOB::I) {
os() << " "; os() << chunk_char;
} }
else { else {
os() << chunk_char; os() << empty_char;
} }
last_tag = chan.get_iob_at(idx); std::string now(empty_char);
std::string now(" "); if (this_tag != IOB::O) {
if (last_tag != IOB::O) {
if (chan.is_head_at(idx)) { if (chan.is_head_at(idx)) {
now = head_char; now = head_char;
} }
...@@ -98,7 +96,6 @@ void LineWriter::write_sentence(const Sentence& s) ...@@ -98,7 +96,6 @@ void LineWriter::write_sentence(const Sentence& s)
for (int line_pos = orth_lens[idx]; line_pos > 0; line_pos--) { for (int line_pos = orth_lens[idx]; line_pos > 0; line_pos--) {
os() << now; os() << now;
} }
last_tag = this_tag;
} }
os() << "\n"; os() << "\n";
} }
......
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