#include <sent/stddefs.h>
#include <sent/ngram2.h>
Include dependency graph for ngram_write_bin.c:
Go to the source code of this file.
Functions | |
static void | wrt (FILE *fp, void *buf, size_t unitbyte, int unitnum) |
static void | write_header (FILE *fp, char *str, int version) |
boolean | ngram_write_bin (FILE *fp, NGRAM_INFO *ndata, char *headerstr) |
Variables | |
static boolean | need_swap |
TRUE if need byte swap. |
There is full upward- and cross-machine compatibility in 3.5. Old binary N-gram files still can be read directly, in which case the conversion to 24bit index will performed just after model has been read. Byte order will also considered by header information, so binary N-gram still can be used among different machines.
Definition in file ngram_write_bin.c.
static void wrt | ( | FILE * | fp, | |
void * | buf, | |||
size_t | unitbyte, | |||
int | unitnum | |||
) | [static] |
Binary write function, with byte swapping if needed.
fp | [in] file pointer | |
buf | [in] data buffer to write | |
unitbyte | [in] unit size in bytes | |
unitnum | [in] number of unit to write |
Definition at line 66 of file ngram_write_bin.c.
static void write_header | ( | FILE * | fp, | |
char * | str, | |||
int | version | |||
) | [static] |
Write header information, with identifier string.
fp | [in] file pointer | |
str | [in] user header string (any string within BINGRAM_HDSIZE bytes is allowed) | |
version | [in] file format version id |
Definition at line 89 of file ngram_write_bin.c.
Referenced by ngram_write_bin().
boolean ngram_write_bin | ( | FILE * | fp, | |
NGRAM_INFO * | ndata, | |||
char * | headerstr | |||
) |
Write a whole N-gram data in binary format.
fp | [in] file pointer | |
ndata | [in] N-gram data to write | |
headerstr | [in] user header string |
Definition at line 128 of file ngram_write_bin.c.