tables-core.h.svn-base

来自「解码器是基于短语的统计机器翻译系统的核心模块」· SVN-BASE 代码 · 共 59 行

SVN-BASE
59
字号
#ifndef _TABLES_H#define _TABLES_Husing namespace std;#include <iostream>#include <fstream>#include <assert.h>#include <stdlib.h>#include <string>#include <queue>#include <map>#include <cmath>vector<string> tokenize( char[] );typedef string WORD;typedef unsigned int WORD_ID;class Vocabulary { public:  map<WORD, WORD_ID>  lookup;  vector< WORD > vocab;  WORD_ID storeIfNew( WORD );  WORD_ID getWordID( WORD );  inline WORD &getWord( WORD_ID id ) { return vocab[ id ]; }};typedef vector< WORD_ID > PHRASE;typedef unsigned int PHRASE_ID;class PhraseTable { public:  map< PHRASE, PHRASE_ID > lookup;  vector< PHRASE > phraseTable;  PHRASE_ID storeIfNew( PHRASE );  PHRASE_ID getPhraseID( PHRASE );  void clear();  inline PHRASE &getPhrase( const PHRASE_ID id ) { return phraseTable[ id ]; }};typedef vector< pair< PHRASE_ID, double > > PHRASEPROBVEC;class TTable { public:  map< PHRASE_ID, vector< pair< PHRASE_ID, double > > > ttable;  map< PHRASE_ID, vector< pair< PHRASE_ID, vector< double > > > > ttableMulti;};class DTable { public:  map< int, double > dtable;  void init();  void load( string );  double get( int );};#endif

⌨️ 快捷键说明

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