Skip to content
Snippets Groups Projects
Commit 38b79e69 authored by ilor's avatar ilor
Browse files

fixes

parent 0e0a9d81
Branches
No related merge requests found
...@@ -141,12 +141,12 @@ Sentence::Ptr IobChanReader::actual_next_sentence() ...@@ -141,12 +141,12 @@ Sentence::Ptr IobChanReader::actual_next_sentence()
while (is().good()) { while (is().good()) {
std::getline(is(), line); std::getline(is(), line);
if (line.empty()) { if (line.empty()) {
return s; break;
} }
std::vector<std::string> spl; std::vector<std::string> spl;
boost::algorithm::split(spl, line, boost::is_any_of("\t")); boost::algorithm::split(spl, line, boost::is_any_of("\t"));
if (spl.size() != 4) { if (spl.size() != 4) {
std::cerr << "Invalid line: " << line << "\n"; std::cerr << "Invalid line: " << line << "(" << spl.size() << ")\n";
} else { } else {
const std::string& orth = spl[0]; const std::string& orth = spl[0];
const std::string& lemma = spl[1]; const std::string& lemma = spl[1];
...@@ -160,6 +160,10 @@ Sentence::Ptr IobChanReader::actual_next_sentence() ...@@ -160,6 +160,10 @@ Sentence::Ptr IobChanReader::actual_next_sentence()
if (disamb_) { if (disamb_) {
t->lexemes().back().set_disamb(true); t->lexemes().back().set_disamb(true);
} }
if (!s) {
s = boost::make_shared<AnnotatedSentence>();
t->set_wa(PwrNlp::Whitespace::Newline);
}
s->append(t); s->append(t);
std::vector<std::string> annsplit; std::vector<std::string> annsplit;
boost::algorithm::split(annsplit, anns, boost::is_any_of(",")); boost::algorithm::split(annsplit, anns, boost::is_any_of(","));
...@@ -184,10 +188,11 @@ Sentence::Ptr IobChanReader::actual_next_sentence() ...@@ -184,10 +188,11 @@ Sentence::Ptr IobChanReader::actual_next_sentence()
} }
} }
} }
foreach (const AnnotatedSentence::chan_map_t::value_type& v, s->all_channels()) { if (s) {
s->get_channel(v.first).make_segments_from_iob(); foreach (const AnnotatedSentence::chan_map_t::value_type& v, s->all_channels()) {
s->get_channel(v.first).make_segments_from_iob();
}
} }
return s; return s;
} }
......
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