libsent/src/ngram/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.6

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


関数

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

Binary read function with byte swap

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

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

参照元 check_header(), と ngram_read_bin().

static void check_header ( FILE *  fp  )  [static]

Check header to see whether the version matches.

引数:
fp [in] file pointer

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

参照元 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.c230 行で定義されています。

参照元 init_ngram_bin().


Juliusに対してTue Sep 22 00:15:23 2009に生成されました。  doxygen 1.6.0