Commit 20e3ac15 by xiaotong

make the complete hypotheses

parent 434335e0
...@@ -59,6 +59,7 @@ void T2TStateBundle::MakeStates(int num) ...@@ -59,6 +59,7 @@ void T2TStateBundle::MakeStates(int num)
states[i].pid = T2T_PID_EMPTY; states[i].pid = T2T_PID_EMPTY;
states[i].isEnd = false; states[i].isEnd = false;
states[i].isStart = false; states[i].isStart = false;
states[i].isCompleted = false;
states[i].prob = 0; states[i].prob = 0;
states[i].probPath = 0; states[i].probPath = 0;
states[i].modelScore = 0; states[i].modelScore = 0;
......
...@@ -49,6 +49,9 @@ public: ...@@ -49,6 +49,9 @@ public:
/* indicates whether the state is the start */ /* indicates whether the state is the start */
bool isStart; bool isStart;
/* indicates whether the state is completed */
bool isCompleted;
/* probability of every prediction (last state of the path) */ /* probability of every prediction (last state of the path) */
float prob; float prob;
......
...@@ -425,11 +425,13 @@ void T2TSearch::Expand(T2TStateBundle * prev, T2TStateBundle * beam) ...@@ -425,11 +425,13 @@ void T2TSearch::Expand(T2TStateBundle * prev, T2TStateBundle * beam)
state.last = NULL; state.last = NULL;
state.pid = pid; state.pid = pid;
state.nstep = 0; state.nstep = 0;
state.isCompleted = false;
} }
else{ else{
state.last = last; state.last = last;
state.pid = state.last->pid; state.pid = state.last->pid;
state.nstep = last->nstep + 1; state.nstep = last->nstep + 1;
state.isCompleted = last->isCompleted;
CheckNTErrors(offset < prev->stateNum, "Wrong state index!"); CheckNTErrors(offset < prev->stateNum, "Wrong state index!");
} }
...@@ -445,6 +447,7 @@ void T2TSearch::Expand(T2TStateBundle * prev, T2TStateBundle * beam) ...@@ -445,6 +447,7 @@ void T2TSearch::Expand(T2TStateBundle * prev, T2TStateBundle * beam)
/* check if it is the end of the sequence */ /* check if it is the end of the sequence */
state.isEnd = IsEnd(state.prediction); state.isEnd = IsEnd(state.prediction);
state.isCompleted = (state.isCompleted || state.isEnd);
/* set the ending mark */ /* set the ending mark */
endMarkCPU.SetInt(state.isEnd, k); endMarkCPU.SetInt(state.isEnd, k);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论