/** Update the  previous state map.*/
void LexicalReorderingFeatureFunction::updateTarget() {
  m_prevStates.clear();
  m_accumulator.ZeroAll();
  const Hypothesis * currHypo = getSample().GetTargetTail();
  LRStateHandle prevState(dynamic_cast<const LexicalReorderingState*>(m_mosesLexReorder->EmptyHypothesisState(currHypo->GetInput())));
  while ((currHypo = (currHypo->GetNextHypo()))) {
    LRStateHandle currState(dynamic_cast<const LexicalReorderingState*>(m_mosesLexReorder->Evaluate(currHypo->GetTranslationOption(),prevState.get(),&m_accumulator)));
    for (size_t i = 0; i < currHypo->GetCurrTargetWordsRange().GetNumWordsCovered(); ++i) {
      m_prevStates.push_back(prevState);
    }
    prevState = currState;
  }
  
}
示例#2
0
void SingleStateFeatureFunction::updateTarget() {
  //Update the prevStates map, and the cached scores
    
  m_prevStates.clear();
  m_accumulator.ZeroAll();
  const Moses::Hypothesis* currHypo = getSample().GetTargetTail();
  StateHandle prevState(
    m_mosesFeature->EmptyHypothesisState(currHypo->GetInput()));
  while ((currHypo = (currHypo->GetNextHypo()))) {
    StateHandle currState(m_mosesFeature->Evaluate(
      *currHypo, prevState.get(), &m_accumulator));
    for (size_t i = 0; i < currHypo->GetCurrTargetWordsRange().
        GetNumWordsCovered(); ++i) {
      m_prevStates.push_back(prevState);
    }
    prevState = currState;
  }
}
示例#3
0
/**
 * Checks for the number of neighbors that are in an active state
 */
int gameOfLife::getNumActiveNeighbors(int colIndex, int rowIndex) {
  int ret = 0;
  
  int prevCol = colIndex-1;
  int nextCol = colIndex+1;
  int prevRow = rowIndex-1;
  int nextRow = rowIndex+1;
  
  ret += currState(prevCol, prevRow);
  ret += currState(prevCol, rowIndex);
  ret += currState(prevCol, nextRow);
  
  ret += currState(colIndex, prevRow);
  ret += currState(colIndex, nextRow);
  
  ret += currState(nextCol, prevRow);
  ret += currState(nextCol, rowIndex);
  ret += currState(nextCol, nextRow);
  
  return ret;
}
示例#4
0
文件: gc.cpp 项目: MihailJP/hsplua
void hsplua_cmd::hl_gcinc() { // インクリメンタルGC
	lua_gc(currState(), LUA_GCINC, 0);
	return;
}
示例#5
0
文件: gc.cpp 项目: MihailJP/hsplua
void hsplua_cmd::hl_gcstop() { // GC停止
	lua_gc(currState(), LUA_GCSTOP, 0);
	return;
}
示例#6
0
文件: gc.cpp 项目: MihailJP/hsplua
void hsplua_cmd::hl_gcgen() { // 世代別GC
	lua_gc(currState(), LUA_GCGEN, 0);
	return;
}
示例#7
0
文件: gc.cpp 项目: MihailJP/hsplua
int hsplua_func::hl_gcisrunning() { // GCが実行中かどうかを返す
	ref_val.ival = lua_gc(currState(), LUA_GCISRUNNING, 0);
	return HSPVAR_FLAG_INT;
}
示例#8
0
文件: gc.cpp 项目: MihailJP/hsplua
void hsplua_cmd::hl_gcsetstepmul() { // GCステップ係数設定
	stat = lua_gc(currState(), LUA_GCSETSTEPMUL, exinfo->HspFunc_prm_geti());
	return;
}
示例#9
0
文件: gc.cpp 项目: MihailJP/hsplua
void hsplua_cmd::hl_gcsetpause() { // GC停止期間設定
	stat = lua_gc(currState(), LUA_GCSETPAUSE, exinfo->HspFunc_prm_geti());
	return;
}
示例#10
0
文件: gc.cpp 项目: MihailJP/hsplua
void hsplua_cmd::hl_gcstep() { // GCステップ実行
	stat = lua_gc(currState(), LUA_GCSTEP, exinfo->HspFunc_prm_geti());
	return;
}
示例#11
0
文件: gc.cpp 项目: MihailJP/hsplua
int hsplua_func::hl_gccount() { // Luaが使用しているメモリの量
	ref_val.dval = (double)lua_gc(currState(), LUA_GCCOUNTB, 0) +
		(double)(lua_gc(currState(), LUA_GCCOUNT, 0) * 1024);
	return HSPVAR_FLAG_DOUBLE;
}
示例#12
0
文件: gc.cpp 项目: MihailJP/hsplua
void hsplua_cmd::hl_gccollect() { // GC実行
	lua_gc(currState(), LUA_GCCOLLECT, 0);
	return;
}
示例#13
0
文件: gc.cpp 项目: MihailJP/hsplua
void hsplua_cmd::hl_gcrestart() { // GC再開
	lua_gc(currState(), LUA_GCRESTART, 0);
	return;
}