52 #ifndef KALDI_LM_MIKOLOV_RNNLM_LIB_H_ 53 #define KALDI_LM_MIKOLOV_RNNLM_LIB_H_ 61 #define MAX_STRING 100 62 #define MAX_FILENAME_STRING 300 84 const unsigned int PRIMES[] = {108641969, 116049371, 125925907, 133333309,
85 145678979, 175308587, 197530793, 234567803, 251851741, 264197411,
87 407407183, 459258997, 479012069, 545678687, 560493491, 607407037, 629629243,
88 656789717, 716048933, 718518067, 725925469, 733332871, 753085943, 755555077,
89 782715551, 790122953, 812345159, 814814293, 893826581, 923456189, 940740127,
90 953085797, 985184539, 990122807};
197 real random(real min, real max);
199 void setRnnLMFile(
const std::string &str);
201 void setRandSeed(
int newSeed);
203 int getWordHash(
const char *word);
204 void readWord(
char *word, FILE *fin);
205 int searchVocab(
const char *word);
209 void goToDelimiter(
int delim, FILE *fi);
215 void computeNet(
int last_word,
int word);
216 void copyHiddenLayerToInput();
218 void matrixXvector(
struct neuron *dest,
struct neuron *srcvec,
219 struct synapse *srcmatrix,
int matrix_width,
220 int from,
int to,
int from2,
int to2,
int type);
222 void restoreContextFromVector(
const std::vector<float> &context_in);
223 void saveContextToVector(std::vector<float> *context_out);
225 float computeConditionalLogprob(
226 std::string current_word,
227 const std::vector<std::string> &history_words,
228 const std::vector<float> &context_in,
229 std::vector<float> *context_out);
231 void setUnkSym(
const std::string &unk);
232 void setUnkPenalty(
const std::string &filename);
233 float getUnkPenalty(
const std::string &word);
234 bool isUnk(
const std::string &word);
239 #endif // KALDI_LM_MIKOLOV_RNNLM_LIB_H_
unordered_map< std::string, float > unk_penalty
const int MAX_NGRAM_ORDER
struct synapse * bptt_syn0
struct vocab_word * vocab
int getHiddenLayerSize() const
const unsigned int PRIMES_SIZE
const unsigned int PRIMES[]
#define MAX_FILENAME_STRING