📄 latticelm.h
字号:
/* * LatticeLM.h -- * Language model using lattice transition probabilities * * Copyright (c) 2003 SRI International. All Rights Reserved. * * @(#)$Header: /home/srilm/devel/lattice/src/RCS/LatticeLM.h,v 1.2 2003/07/13 19:35:54 stolcke Exp $ * */#ifndef _LatticeLM_h_#define _LatticeLM_h_#include <stdio.h>#include "LM.h"#include "Lattice.h"#include "Trellis.h"#include "Array.h"class LatticeLM: public LM{public: LatticeLM(Lattice &lat); /* * LM interface */ LogP wordProb(VocabIndex word, const VocabIndex *context); LogP wordProbRecompute(VocabIndex word, const VocabIndex *context); LogP sentenceProb(const VocabIndex *sentence, TextStats &stats); Boolean read(File &file, Boolean limitVocab = false); void write(File &file);protected: Lattice ⪫ /* our lattice */ Trellis<NodeIndex> trellis; /* for DP over lattice nodes */ const VocabIndex *prevContext; /* context from last DP */ unsigned prevPos; /* position from last DP */ LogP prefixProb(VocabIndex word, const VocabIndex *context, LogP &contextProb, TextStats &stats); /* prefix probability */ Array<VocabIndex> savedContext; /* saved, rev'd copy of last context */ unsigned savedLength; /* length of saved context above */};#endif /* _LatticeLM_h_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -