メインページ | モジュール | データ構造 | Directories | ファイル一覧 | データフィールド | グローバル | 関連ページ

ngram_read_bin.c

バイナリ形式のN-gramファイルを読み込む [詳細]

#include <sent/stddefs.h>
#include <sent/ngram2.h>

ngram_read_bin.cのインクルード依存関係図

ソースコードを見る。

関数

static void rdn (FILE *fp, void *buf, size_t unitbyte, int unitnum)
static void check_header (FILE *fp)
boolean ngram_read_bin (FILE *fp, NGRAM_INFO *ndata)

変数

static int file_version
 N-gram format version of the file.
static boolean need_swap
 TRUE if need byte swap.


説明

バイナリ形式のN-gramファイルを読み込む

作者:
Akinobu LEE
日付:
Wed Feb 16 17:12:08 2005
バイナリ形式では 2-gram と逆向き 3-gram が1つのファイルに 収められています.バイナリ形式はJuilus独自形式のみをサポートしており, 他のバイナリ形式と互換性はありませんので注意して下さい.

rev.3.5 より,バイナリN-gramのファイル形式の一部が変更されました. バイトオーダーが Big endian 固定からマシン依存に変更され(ヘッダに 変換時の条件を記述), またインデックスの 24bit 化 および 2-gram のバックオフデータの圧縮も行われました. これにより,3.5 以降の mkbingram で生成したバイナリN-gramは, 3.4.2以前の Julius では使えませんので注意してください. (ヘッダチェックでエラーとなる)

なお 3.5 以降の Julius では従来のモデルも問題なく読める.この場合, インデックスの 24bit 化とバックオフの圧縮はモデル読み込み時に その都度行われる.またバイトオーダーはヘッダを見て適宜変換するので, 異なるバイトオーダーのマシンで生成した バイナリN-gramでも問題なく読める.もちろん従来のモデルもそのまま 読み込める.

Revision
1.3

ngram_read_bin.c で定義されています。


関数

static void rdn FILE *  fp,
void *  buf,
size_t  unitbyte,
int  unitnum
[static]
 

Binary read function with byte swap (assume file is BIG ENDIAN)

引数:
fp [in] file pointer
buf [out] data buffer
unitbyte [in] unit size in bytes
unitnum [in] number of unit to read.

ngram_read_bin.c75 行で定義されています。

static void check_header FILE *  fp  )  [static]
 

Check header to see whether the version matches.

引数:
fp [in] file pointer

ngram_read_bin.c96 行で定義されています。

参照元 ngram_read_bin().

boolean ngram_read_bin FILE *  fp,
NGRAM_INFO ndata
 

Read a N-gram binary file and store to data.

引数:
fp [in] file pointer
ndata [out] N-gram data to store the read data
戻り値:
TRUE on success, FALSE on failure.

ngram_read_bin.c163 行で定義されています。

参照元 init_ngram_bin().


Juliusに対してTue Mar 28 16:22:31 2006に生成されました。  doxygen 1.4.2