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

Added support for unlabeled parsing

parent 8755a0fa
Branches
No related tags found
No related merge requests found
......@@ -271,6 +271,10 @@ void Oracle::createDatabase()
return eos.ref[stackHead] != "1";
}
else if (parts[0] == "WRITE" && parts.size() == 4)
{
return action == "WRITE 0 LABEL " + c.getTape("LABEL").ref[c.head] || c.head >= (int)c.tapes[0].ref.size()-1;
}
else if (parts[0] == "REDUCE")
{
for (int i = head; i <= sentenceEnd; i++)
......@@ -332,7 +336,16 @@ void Oracle::explainCostOfAction(FILE * output, Config & c, const std::string &
auto parts = split(action);
if (parts[0] == "WRITE")
{
fprintf(output, "Wrong write\n");
if (parts.size() != 4)
{
fprintf(stderr, "Wrong number of action arguments\n");
return;
}
auto index = parts[1];
auto tape = parts[2];
auto label = parts[3];
auto expected = c.getTape(tape).ref[std::stoi(index)];
fprintf(output, "Wrong write (%s) expected (%s)\n", label.c_str(), expected.c_str());
return;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment