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

Deleted bug when eos is supposed to deleter inter sentecnes arcs

parent 6968d713
No related branches found
No related tags found
No related merge requests found
...@@ -389,12 +389,12 @@ std::vector<Action::BasicAction> ActionBank::str2sequence(const std::string & na ...@@ -389,12 +389,12 @@ std::vector<Action::BasicAction> ActionBank::str2sequence(const std::string & na
for (int i = b0; i >= 0; i--) for (int i = b0; i >= 0; i--)
{ {
if (eos[i] == ProgramParameters::sequenceDelimiter) if (eos[i-b0] == ProgramParameters::sequenceDelimiter)
break; break;
try try
{ {
int govIndex = i + std::stoi(govs[i]); int govIndex = i + std::stoi(govs[i-b0]);
if (govIndex <= c.stackGetElem(0)) if (govIndex <= c.stackGetElem(0))
{ {
simpleBufferWrite(c, "GOV", std::to_string(rootIndex - i), i-b0); simpleBufferWrite(c, "GOV", std::to_string(rootIndex - i), i-b0);
......
...@@ -651,10 +651,10 @@ float Config::Tape::getScore() ...@@ -651,10 +651,10 @@ float Config::Tape::getScore()
{ {
float res = 0.0; float res = 0.0;
for (int i = 0; i < refSize(); i++) for (int i = 0; i < refSize()-1; i++)
if (getRef(i-head) == getHyp(i-head)) if (getRef(i-head) == getHyp(i-head))
res += 1; res += 1;
return 100.0*res / refSize(); return 100.0*res / (refSize()-1);
} }
...@@ -469,6 +469,9 @@ void Oracle::createDatabase() ...@@ -469,6 +469,9 @@ void Oracle::createDatabase()
} }
} }
if (c.stackSize() && stackHead == head)
cost++;
return eos.getRef(stackHead-head) != ProgramParameters::sequenceDelimiter ? cost : cost+1; return eos.getRef(stackHead-head) != ProgramParameters::sequenceDelimiter ? cost : cost+1;
} }
else if (parts[0] == "WRITE" && parts.size() == 4) else if (parts[0] == "WRITE" && parts.size() == 4)
...@@ -552,8 +555,18 @@ void Oracle::createDatabase() ...@@ -552,8 +555,18 @@ void Oracle::createDatabase()
return parts.size() == 1 || labels.getRef(0) == parts[1] ? cost : cost+1; return parts.size() == 1 || labels.getRef(0) == parts[1] ? cost : cost+1;
} }
else if (parts[0] == ProgramParameters::sequenceDelimiterTape) else if (parts[0] == "EOS")
{
for (int j = 1; j < c.stackSize(); j++)
{ {
auto s = c.stackGetElem(j);
int noGovs = -1;
if (govs.getHyp(s-head).empty())
noGovs++;
if (noGovs > 0)
cost += noGovs;
}
return eos.getRef(stackHead-head) == ProgramParameters::sequenceDelimiter ? cost : cost+1; return eos.getRef(stackHead-head) == ProgramParameters::sequenceDelimiter ? cost : cost+1;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment