vocabmultimap.h

来自「这是一款很好用的工具包」· C头文件 代码 · 共 64 行

H
64
字号
/* * VocabMultiMap.h -- *	Probabilistic mappings between a vocabulary and strings from *	another vocabulary (as in dictionaries). * * Copyright (c) 2000 SRI International.  All Rights Reserved. * * @(#)$Header: /home/srilm/devel/lm/src/RCS/VocabMultiMap.h,v 1.2 2001/05/21 17:13:51 stolcke Exp $ * */#ifndef _VocabMultiMap_h_#define _VocabMultiMap_h_#include "Boolean.h"#include "Prob.h"#include "Vocab.h"#include "Map2.h"class VocabMultiMap{    friend class VocabMultiMapIter;public:    VocabMultiMap(Vocab &v1, Vocab &v2, Boolean logmap = false);        Prob get(VocabIndex w1, const VocabIndex *w2);    void put(VocabIndex w1, const VocabIndex *w2, Prob prob);    void remove(VocabIndex w1, const VocabIndex *w2);    virtual Boolean read(File &file);    virtual Boolean write(File &file);        Vocab &vocab1;    Vocab &vocab2;private:    /*     * The map is implemented by a two-level map where the first index is     * from vocab1 and the second from strings over vocab2     */    Map2<VocabIndex,const VocabIndex *,Prob> map;    Boolean logmap;			/* treat probabilities as log probs */};/* * Iteration over the mappings of a word */class VocabMultiMapIter{public:    VocabMultiMapIter(VocabMultiMap &vmap, VocabIndex w);    void init();    const VocabIndex *next(Prob &prob);private:    Map2Iter2<VocabIndex,const VocabIndex *,Prob> mapIter;};#endif /* _VocabMultiMap_h_ */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?