sumom****@users*****
sumom****@users*****
2008年 8月 5日 (火) 18:50:53 JST
Index: julius4/libsent/src/dfa/init_dfa.c diff -u julius4/libsent/src/dfa/init_dfa.c:1.2 julius4/libsent/src/dfa/init_dfa.c:1.3 --- julius4/libsent/src/dfa/init_dfa.c:1.2 Tue Dec 18 17:45:51 2007 +++ julius4/libsent/src/dfa/init_dfa.c Tue Aug 5 18:50:53 2008 @@ -20,7 +20,7 @@ * @author Akinobu LEE * @date Tue Feb 15 14:20:43 2005 * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * */ /* @@ -162,48 +162,3 @@ return TRUE; } -/** - * Read grammar (DFA and dictionary) from socket and returns newly allocated - * grammars. - * - * @param sd [in] socket descpriter - * @param ret_dfa [out] read DFA - * @param ret_winfo [out] read dictionary - * @param hmminfo [in] HMM definition - * - * @return TRUE on success, or FALSE on failure. - * </EN> - */ -boolean -read_grammar_from_socket(int sd, DFA_INFO **ret_dfa, WORD_INFO **ret_winfo, HTK_HMM_INFO *hmminfo) -{ - DFA_INFO *dfa; - WORD_INFO *winfo; - - /* load grammar: dfa and dict in turn */ - dfa = dfa_info_new(); - if (! -#ifdef WINSOCK - rddfa_sd(sd, dfa) -#else - rddfa_fd(sd, dfa) -#endif - ) { - return FALSE; - } - winfo = word_info_new(); - /* ignore MONOTREE */ - if (! -#ifdef WINSOCK - voca_load_htkdict_sd(sd, winfo, hmminfo, FALSE) -#else - voca_load_htkdict_fd(sd, winfo, hmminfo, FALSE) -#endif - ) { - dfa_info_free(dfa); - return FALSE; - } - *ret_dfa = dfa; - *ret_winfo = winfo; - return TRUE; -} Index: julius4/libsent/src/dfa/rddfa.c diff -u julius4/libsent/src/dfa/rddfa.c:1.2 julius4/libsent/src/dfa/rddfa.c:1.3 --- julius4/libsent/src/dfa/rddfa.c:1.2 Tue Dec 18 17:45:51 2007 +++ julius4/libsent/src/dfa/rddfa.c Tue Aug 5 18:50:53 2008 @@ -12,7 +12,7 @@ * @author Akinobu LEE * @date Tue Feb 15 14:54:40 2005 * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * */ /* @@ -69,7 +69,7 @@ } /** - * Top loop function to read DFA grammar via file pointer + * Top loop function to read DFA grammar via file pointer (gzip enabled) * * @param fp [in] file pointer that points to the DFA grammar data * @param dinfo [out] the read data will be stored in this DFA grammar structure @@ -101,43 +101,13 @@ /** * Top loop function to read DFA grammar via file descriptor * - * @param fd [in] file descriptor that points to the DFA grammar data - * @param dinfo [out] the read data will be stored in this DFA grammar structure - * - * @return TRUE on success, FALSE on failure. - */ -boolean -rddfa_fd(int fd, DFA_INFO *dinfo) -{ - int state_max, arc_num, terminal_max; - - /* initialize */ - dfa_state_init(dinfo); - state_max = 0; - arc_num = 0; - terminal_max = 0; - - while(getl_fd(buf, MAXLINELEN, fd) != NULL) { - if (rddfa_line(buf, dinfo, &state_max, &arc_num, &terminal_max) == FALSE) { - break; - } - } - dinfo->state_num = state_max + 1; - dinfo->arc_num = arc_num; - dinfo->term_num = terminal_max + 1; - return(TRUE); -} - -/** - * Top loop function to read DFA grammar via socket descriptor - * - * @param sd [in] socket descriptor that points to the DFA grammar data + * @param fp [in] file pointer that points to the DFA grammar data * @param dinfo [out] the read data will be stored in this DFA grammar structure * * @return TRUE on success, FALSE on failure. */ boolean -rddfa_sd(int sd, DFA_INFO *dinfo) +rddfa_fp(FILE *fp, DFA_INFO *dinfo) { int state_max, arc_num, terminal_max; @@ -147,7 +117,7 @@ arc_num = 0; terminal_max = 0; - while(getl_sd(buf, MAXLINELEN, sd) != NULL) { + while(getl_fp(buf, MAXLINELEN, fp) != NULL) { if (rddfa_line(buf, dinfo, &state_max, &arc_num, &terminal_max) == FALSE) { break; }