Skip to content
Snippets Groups Projects
Commit cde0caab authored by Franck Dary's avatar Franck Dary
Browse files

Fixed arc from one sentence to another

parent cb66ca9f
Branches
No related tags found
No related merge requests found
...@@ -596,7 +596,18 @@ std::vector<Action::BasicAction> ActionBank::str2sequence(const std::string & na ...@@ -596,7 +596,18 @@ std::vector<Action::BasicAction> ActionBank::str2sequence(const std::string & na
simpleBufferWrite(c, "LABEL", "root", rootIndex-b0); simpleBufferWrite(c, "LABEL", "root", rootIndex-b0);
// Delete the arcs from the previous sentence to the new sentence // Delete the arcs from the previous sentence to the new sentence
// TODO for (int i = b0; i > c.stackTop(); i--)
{
try
{
if (std::stoi(govs[i-b0])+i <= c.stackTop())
{
simpleBufferWrite(c, "GOV", "", i-b0);
simpleBufferWrite(c, "LABEL", "", i-b0);
}
}
catch (std::exception &) {continue;}
}
}; };
auto undo = [](Config & c, Action::BasicAction & ba) auto undo = [](Config & c, Action::BasicAction & ba)
{ {
......
...@@ -869,16 +869,25 @@ void Config::updateIdsInSequence() ...@@ -869,16 +869,25 @@ void Config::updateIdsInSequence()
} }
int curId = 1; int curId = 1;
int digitIndex = 1;
for (int i = sentenceStart; i <= sentenceEnd; i++) for (int i = sentenceStart; i <= sentenceEnd; i++)
{ {
auto splited = split(ids.getRef(i-getHead()), '-'); auto splited = split(ids.getRef(i-getHead()), '-');
if (splited.size() == 1) if (splited.size() == 1)
{
auto splited2 = split(ids.getRef(i-getHead()), '.');
if (splited2.size() == 1)
{ {
ids.setHyp(i-getHead(), std::to_string(curId++)); ids.setHyp(i-getHead(), std::to_string(curId++));
digitIndex = 1;
continue; continue;
} }
ids.setHyp(i-getHead(), std::to_string(curId)+"."+std::to_string(digitIndex));
digitIndex++;
}
int multiWordSize = splited.size(); int multiWordSize = splited.size();
ids.setHyp(i-getHead(), std::to_string(curId)+"-"+std::to_string(curId+multiWordSize-1)); ids.setHyp(i-getHead(), std::to_string(curId)+"-"+std::to_string(curId+multiWordSize-1));
digitIndex = 1;
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment