/*************************************************************************** * This file is part of the 'Shout LVCS Recognition toolkit'. * *************************************************************************** * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 by Marijn Huijbregts * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; version 2 of the License. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "standard.h" #include "languagemodel_segmenter.h" #include ///////////////////////////////////////////////////////////////////////////////////////////////////// /// \todo Docs ///////////////////////////////////////////////////////////////////////////////////////////////////// LanguageModel_Segmenter::LanguageModel_Segmenter(int uniNr) : LanguageModel(uniNr) { transfer_uni = new int[uni_tableLength]; transfer_bi = new int[uni_tableLength*uni_tableLength]; probs_bi = new float[uni_tableLength*uni_tableLength]; for(int i=0;i 0) { probs_bi[i+uni_tableLength*i2] = log(((float)transfer_bi[i+uni_tableLength*i2]) / ((float)transfer_uni[i])); } else { probs_bi[i+uni_tableLength*i2] = -10; } } } for(int i=0;i 0) { res = probs_bi[wordHistory[0] + uni_tableLength*newWordID]; } else { res = uni_lmData[newWordID].p; } wordHistoryOut[0] = newWordID; wordHistoryOut[1] = -1; wordHistoryOut[2] = -1; return res; }