00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _SIH_H_
00019 #define _SIH_H_
00020
00021 #include <sys/types.h>
00022 #include <stdio.h>
00023 #include "general.h"
00024
00033 typedef struct {
00034 char *string;
00035 int32 intval;
00036 } sih_slot_t;
00037
00038
00043 typedef struct {
00044 double max_occupancy;
00045 double growth_ratio;
00046 int warn_on_update;
00047 int nslots;
00048 int nentries;
00049 sih_slot_t *slots;
00050 } sih_t;
00051
00055 sih_t *sih_create(int initial_size,
00056 double max_occupancy,
00057 double growth_ratio,
00058 int warn_on_update
00059 );
00060
00064 void sih_add(sih_t *ht,
00065 char *string,
00066 int32 intval
00067 );
00068
00072 char sih_lookup(sih_t *ht,
00073 char *string,
00074 int32 *p_intval
00075 );
00076
00080 void *sih_val_write_to_file(sih_t *ht,
00081 FILE *fp,
00082 char *filename,
00083 int verbosity
00084 );
00085
00089 void *sih_val_read_from_file(sih_t *ht,
00090 FILE *fp,
00091 char *filename,
00092 int verbosity
00093 );
00094
00095
00096
00097 void get_vocab_from_vocab_ht(sih_t *ht, int vocab_size, int verbosity, char ***p_vocab);
00098
00099
00100
00103 void read_wlist_into_siht(char *wlist_filename,
00104 int verbosity,
00105 sih_t *p_word_id_ht,
00106 int *p_n_wlist
00107 );
00108
00109 void read_wlist_into_array(char *wlist_filename, int verbosity,
00110 char ***p_wlist, int *p_n_wlist);
00111
00112 #endif