From sumomo ¡÷ users.sourceforge.jp Tue Aug 5 18:46:54 2008 From: sumomo ¡÷ users.sourceforge.jp (sumomo ¡÷ users.sourceforge.jp) Date: Tue, 05 Aug 2008 18:46:54 +0900 Subject: [Julius-cvs 213] CVS update: julius4/jcontrol Message-ID: <1217929614.852444.24237.nullmailer@users.sourceforge.jp> Index: julius4/jcontrol/configure diff -u julius4/jcontrol/configure:1.1.1.1 julius4/jcontrol/configure:1.2 --- julius4/jcontrol/configure:1.1.1.1 Fri Sep 28 11:50:55 2007 +++ julius4/jcontrol/configure Tue Aug 5 18:46:53 2008 @@ -1160,7 +1160,7 @@ case "$host_os" in mingw*) - EXTRALIB="$EXTRALIB -lwsock32" + EXTRALIB="$EXTRALIB -lws2_32" ;; esac Index: julius4/jcontrol/configure.in diff -u julius4/jcontrol/configure.in:1.2 julius4/jcontrol/configure.in:1.3 --- julius4/jcontrol/configure.in:1.2 Tue Dec 18 17:45:48 2007 +++ julius4/jcontrol/configure.in Tue Aug 5 18:46:53 2008 @@ -12,7 +12,7 @@ AC_CHECK_FUNC(connect,,AC_CHECK_LIB(socket, connect)) case "$host_os" in mingw*) - EXTRALIB="$EXTRALIB -lwsock32" + EXTRALIB="$EXTRALIB -lws2_32" ;; esac AC_SUBST(EXTRALIB) From sumomo ¡÷ users.sourceforge.jp Tue Aug 5 18:47:56 2008 From: sumomo ¡÷ users.sourceforge.jp (sumomo ¡÷ users.sourceforge.jp) Date: Tue, 05 Aug 2008 18:47:56 +0900 Subject: [Julius-cvs 214] CVS update: julius4/libjulius/src Message-ID: <1217929676.228478.24621.nullmailer@users.sourceforge.jp> Index: julius4/libjulius/src/m_fusion.c diff -u julius4/libjulius/src/m_fusion.c:1.8 julius4/libjulius/src/m_fusion.c:1.9 --- julius4/libjulius/src/m_fusion.c:1.8 Thu Jul 24 18:18:09 2008 +++ julius4/libjulius/src/m_fusion.c Tue Aug 5 18:47:56 2008 @@ -20,7 +20,7 @@ * @author Akinobu Lee * @date Thu May 12 13:31:47 2005 * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * */ /* @@ -1100,17 +1100,15 @@ /* set beam width */ /* guess beam width from models, when not specified */ p->trellis_beam_width = set_beam_width(p->wchmm, p->config->pass1.specified_trellis_beam_width); + + /* initialize cache for factoring */ + max_successor_cache_init(p->wchmm); } /* backtrellis initialization */ p->backtrellis = (BACKTRELLIS *)mymalloc(sizeof(BACKTRELLIS)); bt_init(p->backtrellis); - /* initialize cache for factoring */ - if (p->lmtype == LM_PROB) { - max_successor_cache_init(p->wchmm); - } - jlog("STAT: SR%02d %s composed\n", sconf->id, sconf->name); if (sconf->sw.start_inactive) { @@ -1120,6 +1118,13 @@ /* book activation for the recognition */ p->active = 1; } + if (p->lmtype == LM_DFA) { + if (p->lm->winfo == NULL || + (p->lmvar == LM_DFA_GRAMMAR && p->lm->dfa == NULL)) { + /* make this instance inactive */ + p->active = -1; + } + } return TRUE; } Index: julius4/libjulius/src/m_info.c diff -u julius4/libjulius/src/m_info.c:1.7 julius4/libjulius/src/m_info.c:1.8 --- julius4/libjulius/src/m_info.c:1.7 Tue Jul 1 13:29:45 2008 +++ julius4/libjulius/src/m_info.c Tue Aug 5 18:47:56 2008 @@ -12,7 +12,7 @@ * @author Akinobu Lee * @date Thu May 12 14:14:01 2005 * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * */ /* @@ -640,19 +640,21 @@ jlog("\t all possible words will be expanded in 2nd pass\n"); } } - if (r->wchmm->category_tree) { - if (r->config->pass1.old_tree_function_flag) { - jlog("\t build_wchmm() used\n"); - } else { - jlog("\t build_wchmm2() used\n"); - } + if (r->wchmm != NULL) { + if (r->wchmm->category_tree) { + if (r->config->pass1.old_tree_function_flag) { + jlog("\t build_wchmm() used\n"); + } else { + jlog("\t build_wchmm2() used\n"); + } #ifdef PASS1_IWCD #ifdef USE_OLD_IWCD - jlog("\t full lcdset used\n"); + jlog("\t full lcdset used\n"); #else - jlog("\t lcdset limited by word-pair constraint\n"); + jlog("\t lcdset limited by word-pair constraint\n"); #endif #endif /* PASS1_IWCD */ + } } if (r->config->output.progout_flag) { jlog("\tprogressive output on 1st pass\n"); Index: julius4/libjulius/src/m_options.c diff -u julius4/libjulius/src/m_options.c:1.11 julius4/libjulius/src/m_options.c:1.12 --- julius4/libjulius/src/m_options.c:1.11 Fri Jul 18 07:56:21 2008 +++ julius4/libjulius/src/m_options.c Tue Aug 5 18:47:56 2008 @@ -18,7 +18,7 @@ * @author Akinobu Lee * @date Thu May 12 18:52:07 2005 * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * */ /* @@ -692,6 +692,10 @@ multigram_remove_gramlist(jconf->lmnow); FREE_MEMORY(jconf->lmnow->dfa_filename); FREE_MEMORY(jconf->lmnow->dictfilename); + if (jconf->lmnow->lmtype == LM_UNDEF) { + jconf->lmnow->lmtype = LM_DFA; + jconf->lmnow->lmvar = LM_DFA_GRAMMAR; + } continue; } else if (strmatch(argv[i],"-dfa")) { /* DFA filename */ FREE_MEMORY(jconf->lmnow->dfa_filename); Index: julius4/libjulius/src/multi-gram.c diff -u julius4/libjulius/src/multi-gram.c:1.4 julius4/libjulius/src/multi-gram.c:1.5 --- julius4/libjulius/src/multi-gram.c:1.4 Sun Jul 20 01:52:33 2008 +++ julius4/libjulius/src/multi-gram.c Tue Aug 5 18:47:56 2008 @@ -47,7 +47,7 @@ * @author Akinobu Lee * @date Sat Jun 18 23:45:18 2005 * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * */ /* @@ -178,10 +178,10 @@ jlog("ERROR: multi-gram: failed to re-build tree lexicon\n"); return FALSE; } - } #ifdef MDEBUG - jlog("STAT: wchmm (re)build completed\n"); + jlog("STAT: wchmm (re)build completed\n"); #endif + } return(TRUE); } From sumomo ¡÷ users.sourceforge.jp Tue Aug 5 18:49:00 2008 From: sumomo ¡÷ users.sourceforge.jp (sumomo ¡÷ users.sourceforge.jp) Date: Tue, 05 Aug 2008 18:49:00 +0900 Subject: [Julius-cvs 215] CVS update: julius4/libsent Message-ID: <1217929740.246649.25902.nullmailer@users.sourceforge.jp> Index: julius4/libsent/configure diff -u julius4/libsent/configure:1.8 julius4/libsent/configure:1.9 --- julius4/libsent/configure:1.8 Mon Jul 7 14:50:11 2008 +++ julius4/libsent/configure Tue Aug 5 18:49:00 2008 @@ -1842,7 +1842,7 @@ case "$host_os" in mingw*) - EXTRALIB="$EXTRALIB -lwsock32" + EXTRALIB="$EXTRALIB -lws2_32" ;; esac Index: julius4/libsent/configure.in diff -u julius4/libsent/configure.in:1.8 julius4/libsent/configure.in:1.9 --- julius4/libsent/configure.in:1.8 Mon Jul 7 14:50:11 2008 +++ julius4/libsent/configure.in Tue Aug 5 18:49:00 2008 @@ -3,7 +3,7 @@ dnl Copyright (c) 2005-2007 Julius project team, Nagoya Institute of Technology dnl All rights reserved dnl -dnl $Id: configure.in,v 1.8 2008/07/07 05:50:11 sumomo Exp $ +dnl $Id: configure.in,v 1.9 2008/08/05 09:49:00 sumomo Exp $ dnl dnl Process this file with autoconf to produce a configure script. @@ -145,7 +145,7 @@ AC_CHECK_FUNCS(sleep) case "$host_os" in mingw*) - EXTRALIB="$EXTRALIB -lwsock32" + EXTRALIB="$EXTRALIB -lws2_32" ;; esac From sumomo ¡÷ users.sourceforge.jp Tue Aug 5 18:49:00 2008 From: sumomo ¡÷ users.sourceforge.jp (sumomo ¡÷ users.sourceforge.jp) Date: Tue, 05 Aug 2008 18:49:00 +0900 Subject: [Julius-cvs 216] CVS update: julius4/libsent/src/net Message-ID: <1217929740.462527.25912.nullmailer@users.sourceforge.jp> Index: julius4/libsent/src/net/server-client.c diff -u julius4/libsent/src/net/server-client.c:1.2 julius4/libsent/src/net/server-client.c:1.3 --- julius4/libsent/src/net/server-client.c:1.2 Tue Dec 18 17:45:53 2007 +++ julius4/libsent/src/net/server-client.c Tue Aug 5 18:49:00 2008 @@ -12,7 +12,7 @@ * @author Akinobu LEE * @date Wed Feb 16 07:18:13 2005 * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * */ /* @@ -49,14 +49,14 @@ /* init winsock */ if (!winsock_initialized) { WSADATA data; - WSAStartup(0x1010, &data); + WSAStartup(MAKEWORD(2,0), &data); winsock_initialized = TRUE; } #endif /* create socket */ #ifdef WINSOCK - if((sd = socket(PF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET){ + if((sd = WSASocket(AF_INET, SOCK_STREAM, IPPROTO_TCP, NULL, 0, 0)) == INVALID_SOCKET){ jlog("Error: server-client: socket() error\n"); jlog("Error: server-client: error code = %d\n", WSAGetLastError()); switch(WSAGetLastError()) { From sumomo ¡÷ users.sourceforge.jp Tue Aug 5 18:50:53 2008 From: sumomo ¡÷ users.sourceforge.jp (sumomo ¡÷ users.sourceforge.jp) Date: Tue, 05 Aug 2008 18:50:53 +0900 Subject: [Julius-cvs 217] CVS update: julius4/julius Message-ID: <1217929853.616278.27413.nullmailer@users.sourceforge.jp> Index: julius4/julius/module.c diff -u julius4/julius/module.c:1.4 julius4/julius/module.c:1.5 --- julius4/julius/module.c:1.4 Mon Feb 18 23:35:05 2008 +++ julius4/julius/module.c Tue Aug 5 18:50:53 2008 @@ -7,6 +7,7 @@ static int module_mode = FALSE; static int module_port = DEFAULT_MODULEPORT; int module_sd = -1; +static FILE *module_fp; static RecogProcess *cur = NULL; #define MAXBUFLEN 4096 ///< Maximum line length of a message sent from a client @@ -56,6 +57,59 @@ return(ret); } +static char * +myfgets(char *buf, int maxlen, FILE *fp) +{ + char *ret; + int len; + + if ((ret = fgets(buf, maxlen, fp)) != NULL) { + len = strlen(buf); + if (buf[len-1] == '\n') { + buf[len-1] = '\0'; + if (len >= 2 && buf[len-2] == '\r') { + buf[len-2] = '\0'; + } + } + } + return ret; +} + +/** + * 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. + * + */ +static boolean +read_grammar(FILE *fp, 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 (!rddfa_fp(fp, dfa)) { + return FALSE; + } + winfo = word_info_new(); + /* ignore MONOTREE */ + if (!voca_load_htkdict_fp(fp, winfo, hmminfo, FALSE)) { + dfa_info_free(dfa); + return FALSE; + } + *ret_dfa = dfa; + *ret_winfo = winfo; + return TRUE; +} + + static void send_process_stat(RecogProcess *r) { @@ -162,11 +216,7 @@ } else if (strmatch(command, "INPUTONCHANGE")) { /* change grammar switching timing policy */ if ( -#ifdef WINSOCK - getl_sd(buf, MAXBUFLEN, module_sd) -#else - getl_fd(buf, MAXBUFLEN, module_sd) -#endif + myfgets(buf, MAXBUFLEN, module_fp) == NULL) { fprintf(stderr, "Error: msock(INPUTONCHANGE): no argument\n"); return; @@ -196,7 +246,7 @@ p = NULL; } /* read a new grammar via socket */ - if (read_grammar_from_socket(module_sd, &new_dfa, &new_winfo, cur->am->hmminfo) == FALSE) { + if (read_grammar(module_fp, &new_dfa, &new_winfo, cur->am->hmminfo) == FALSE) { module_send(module_sd, "\n.\n"); } else { if (cur->lmtype == LM_DFA) { @@ -207,6 +257,8 @@ /* need to rebuild the global lexicon */ /* tell engine to update at requested timing */ schedule_grammar_update(recog); + /* make sure this process will be activated */ + cur->active = 1; /* tell module client */ module_send(module_sd, "\n.\n"); send_gram_info(cur); @@ -228,13 +280,15 @@ p = NULL; } /* read a new grammar via socket */ - if (read_grammar_from_socket(module_sd, &new_dfa, &new_winfo, cur->am->hmminfo) == FALSE) { + if (read_grammar(module_fp, &new_dfa, &new_winfo, cur->am->hmminfo) == FALSE) { module_send(module_sd, "\n.\n"); } else { if (cur->lmtype == LM_DFA) { /* add it to multi-gram tree */ multigram_add(new_dfa, new_winfo, p, cur->lm); /* need to rebuild the global lexicon */ + /* make sure this process will be activated */ + cur->active = 1; /* tell engine to update at requested timing */ schedule_grammar_update(recog); /* tell module client */ @@ -248,11 +302,7 @@ /* remove the grammar specified by ID or name */ /* read a list of grammar IDs to be deleted */ if ( -#ifdef WINSOCK - getl_sd(buf, MAXBUFLEN, module_sd) -#else - getl_fd(buf, MAXBUFLEN, module_sd) -#endif + myfgets(buf, MAXBUFLEN, module_fp) == NULL) { fprintf(stderr, "Error: msock(DELGRAM): no argument\n"); return; @@ -288,11 +338,7 @@ /* activate grammar in this engine */ /* read a list of grammar IDs or names to be activated */ if ( -#ifdef WINSOCK - getl_sd(buf, MAXBUFLEN, module_sd) -#else - getl_fd(buf, MAXBUFLEN, module_sd) -#endif + myfgets(buf, MAXBUFLEN, module_fp) == NULL) { fprintf(stderr, "Error: msock(ACTIVATEGRAM): no argument\n"); return; @@ -328,11 +374,7 @@ /* deactivate grammar in this engine */ /* read a list of grammar IDs or names to be de-activated */ if ( -#ifdef WINSOCK - getl_sd(buf, MAXBUFLEN, module_sd) -#else - getl_fd(buf, MAXBUFLEN, module_sd) -#endif + myfgets(buf, MAXBUFLEN, module_fp) == NULL) { fprintf(stderr, "Error: msock(DEACTIVATEGRAM): no argument\n"); return; @@ -381,11 +423,7 @@ JCONF_SEARCH *sconf; RecogProcess *r; if ( -#ifdef WINSOCK - getl_sd(buf, MAXBUFLEN, module_sd) -#else - getl_fd(buf, MAXBUFLEN, module_sd) -#endif + myfgets(buf, MAXBUFLEN, module_fp) == NULL) { /* when no argument, just return current process */ send_current_process(cur); @@ -433,11 +471,7 @@ RecogProcess *r; if ( -#ifdef WINSOCK - getl_sd(buf, MAXBUFLEN, module_sd) -#else - getl_fd(buf, MAXBUFLEN, module_sd) -#endif + myfgets(buf, MAXBUFLEN, module_fp) == NULL) { fprintf(stderr, "Error: msock(ADDPROCESS): no argument\n"); module_send(module_sd, "\n.\n"); @@ -476,11 +510,7 @@ RecogProcess *r; if ( -#ifdef WINSOCK - getl_sd(buf, MAXBUFLEN, module_sd) -#else - getl_fd(buf, MAXBUFLEN, module_sd) -#endif + myfgets(buf, MAXBUFLEN, module_fp) == NULL) { fprintf(stderr, "Error: msock(DELPROCESS): no argument\n"); module_send(module_sd, "\n.\n"); @@ -531,11 +561,7 @@ else if (strmatch(command, "ACTIVATEPROCESS")) { if ( -#ifdef WINSOCK - getl_sd(buf, MAXBUFLEN, module_sd) -#else - getl_fd(buf, MAXBUFLEN, module_sd) -#endif + myfgets(buf, MAXBUFLEN, module_fp) == NULL) { fprintf(stderr, "Error: msock(ACTIVATEPROCESS): no argument\n"); module_send(module_sd, "\n.\n"); @@ -549,11 +575,7 @@ } else if (strmatch(command, "DEACTIVATEPROCESS")) { if ( -#ifdef WINSOCK - getl_sd(buf, MAXBUFLEN, module_sd) -#else - getl_fd(buf, MAXBUFLEN, module_sd) -#endif + myfgets(buf, MAXBUFLEN, module_fp) == NULL) { fprintf(stderr, "Error: msock(DEACTIVATEPROCESS): no argument\n"); module_send(module_sd, "\n.\n"); @@ -573,11 +595,7 @@ /* get gramamr ID to add */ if ( -#ifdef WINSOCK - getl_sd(buf, MAXBUFLEN, module_sd) -#else - getl_fd(buf, MAXBUFLEN, module_sd) -#endif + myfgets(buf, MAXBUFLEN, module_fp) == NULL) { fprintf(stderr, "Error: msock(DEACTIVATEPROCESS): no argument\n"); module_send(module_sd, "\n.\n"); @@ -589,11 +607,7 @@ words = word_info_new(); voca_load_start(words, cur->am->hmminfo, FALSE); while ( -#ifdef WINSOCK - getl_sd(buf, MAXBUFLEN, module_sd) -#else - getl_fd(buf, MAXBUFLEN, module_sd) -#endif + myfgets(buf, MAXBUFLEN, module_fp) != NULL) { if (cur->lmvar == LM_DFA_WORD) { ret = voca_load_word_line(buf, words, cur->am->hmminfo, @@ -667,11 +681,7 @@ /* there is data to read */ /* process command and change status if necessaty */ while(select(module_sd+1, &rfds, NULL, NULL, &tv) > 0 && -#ifdef WINSOCK - getl_sd(mbuf, MAXBUFLEN, module_sd) -#else - getl_fd(mbuf, MAXBUFLEN, module_sd) -#endif + myfgets(mbuf, MAXBUFLEN, module_fp) != NULL) { msock_exec_command(mbuf, recog); } @@ -699,11 +709,7 @@ while(!recog->process_active) { if ( -#ifdef WINSOCK - getl_sd(mbuf, MAXBUFLEN, module_sd) -#else - getl_fd(mbuf, MAXBUFLEN, module_sd) -#endif + myfgets(mbuf, MAXBUFLEN, module_fp) != NULL) { msock_exec_command(mbuf, recog); } @@ -760,6 +766,9 @@ module_server() { int listen_sd; ///< Socket to listen to a client +#if defined(_WIN32) && !defined(__CYGWIN32__) + int sd; +#endif /* prepare socket to listen */ if ((listen_sd = ready_as_server(module_port)) < 0) { @@ -778,6 +787,22 @@ fprintf(stderr, "Error: failed to accept connection\n"); return; } +#if defined(_WIN32) && !defined(__CYGWIN32__) + /* call winsock function to make the socket capable of reading/writing */ + if ((sd = _open_osfhandle(module_sd, O_RDWR|O_BINARY)) < 0) { + fprintf(stderr, "Error: failed to open_osfhandle\n"); + return; + } + if ((module_fp = fdopen(sd, "rb+")) == NULL) { + fprintf(stderr, "Error: failed to fdopen socket\n"); + return; + } +#else + if ((module_fp = fdopen(module_sd, "r+")) == NULL) { + fprintf(stderr, "Error; failed to fdopen socket\n"); + return; + } +#endif } void From sumomo ¡÷ users.sourceforge.jp Tue Aug 5 18:50:53 2008 From: sumomo ¡÷ users.sourceforge.jp (sumomo ¡÷ users.sourceforge.jp) Date: Tue, 05 Aug 2008 18:50:53 +0900 Subject: [Julius-cvs 218] CVS update: julius4/libsent/include/sent Message-ID: <1217929853.782292.27425.nullmailer@users.sourceforge.jp> Index: julius4/libsent/include/sent/dfa.h diff -u julius4/libsent/include/sent/dfa.h:1.3 julius4/libsent/include/sent/dfa.h:1.4 --- julius4/libsent/include/sent/dfa.h:1.3 Mon Jul 21 14:21:16 2008 +++ julius4/libsent/include/sent/dfa.h Tue Aug 5 18:50:53 2008 @@ -29,7 +29,7 @@ * @author Akinobu LEE * @date Thu Feb 10 18:21:27 2005 * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * */ /* @@ -98,8 +98,7 @@ void dfa_state_init(DFA_INFO *dinfo); void dfa_state_expand(DFA_INFO *dinfo, int needed); boolean rddfa(FILE *fp, DFA_INFO *dinfo); -boolean rddfa_fd(int fd, DFA_INFO *dinfo); -boolean rddfa_sd(int sd, DFA_INFO *dinfo); +boolean rddfa_fp(FILE *fp, DFA_INFO *dinfo); boolean rddfa_line(char *line, DFA_INFO *dinfo, int *state_max, int *arc_num, int *terminal_max); void dfa_append(DFA_INFO *dst, DFA_INFO *src, int soffset, int coffset); @@ -131,6 +130,5 @@ #include void dfa_find_pause_word(DFA_INFO *dfa, WORD_INFO *winfo, HTK_HMM_INFO *hmminfo); boolean dfa_pause_word_append(DFA_INFO *dst, DFA_INFO *src, int coffset); -boolean read_grammar_from_socket(int sd, DFA_INFO **ret_dfa, WORD_INFO **ret_winfo, HTK_HMM_INFO *hmminfo); #endif /* __SENT_DFA_H__ */ Index: julius4/libsent/include/sent/util.h diff -u julius4/libsent/include/sent/util.h:1.4 julius4/libsent/include/sent/util.h:1.5 --- julius4/libsent/include/sent/util.h:1.4 Thu Mar 20 18:08:03 2008 +++ julius4/libsent/include/sent/util.h Tue Aug 5 18:50:53 2008 @@ -21,7 +21,7 @@ * @author Akinobu LEE * @date Sat Feb 12 12:30:40 2005 * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * */ /* @@ -60,8 +60,6 @@ /* readfile.c */ char *getl(char *, int, FILE *); char *getl_fp(char *, int, FILE *); -char *getl_fd(char *, int, int); -char *getl_sd(char *, int, int); char *get_line_from_stdin(char *buf, int buflen, char *prompt); /* gzfile.c */ Index: julius4/libsent/include/sent/vocabulary.h diff -u julius4/libsent/include/sent/vocabulary.h:1.2 julius4/libsent/include/sent/vocabulary.h:1.3 --- julius4/libsent/include/sent/vocabulary.h:1.2 Tue Dec 18 17:45:50 2007 +++ julius4/libsent/include/sent/vocabulary.h Tue Aug 5 18:50:53 2008 @@ -30,7 +30,7 @@ * @author Akinobu LEE * @date Sat Feb 12 12:38:13 2005 * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * */ /* @@ -96,8 +96,7 @@ boolean voca_load_line(char *buf, WORD_INFO *winfo, HTK_HMM_INFO *hmminfo); boolean voca_load_end(WORD_INFO *winfo); boolean voca_load_htkdict(FILE *, WORD_INFO *, HTK_HMM_INFO *, boolean); -boolean voca_load_htkdict_fd(int, WORD_INFO *, HTK_HMM_INFO *, boolean); -boolean voca_load_htkdict_sd(int, WORD_INFO *, HTK_HMM_INFO *, boolean); +boolean voca_load_htkdict_fp(FILE *, WORD_INFO *, HTK_HMM_INFO *, boolean); boolean voca_append_htkdict(char *entry, WORD_INFO *winfo, HTK_HMM_INFO *hmminfo, boolean ignore_tri_conv); boolean voca_append(WORD_INFO *dstinfo, WORD_INFO *srcinfo, int coffset, int woffset); boolean voca_load_htkdict_line(char *buf, WORD_ID *vnum, int linenum, WORD_INFO *winfo, HTK_HMM_INFO *hmminfo, boolean do_conv, boolean *ok_flag); From sumomo ¡÷ users.sourceforge.jp Tue Aug 5 18:50:53 2008 From: sumomo ¡÷ users.sourceforge.jp (sumomo ¡÷ users.sourceforge.jp) Date: Tue, 05 Aug 2008 18:50:53 +0900 Subject: [Julius-cvs 219] CVS update: julius4/libsent/src/dfa Message-ID: <1217929853.930364.27434.nullmailer@users.sourceforge.jp> 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. - * - */ -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; } From sumomo ¡÷ users.sourceforge.jp Tue Aug 5 18:50:54 2008 From: sumomo ¡÷ users.sourceforge.jp (sumomo ¡÷ users.sourceforge.jp) Date: Tue, 05 Aug 2008 18:50:54 +0900 Subject: [Julius-cvs 220] CVS update: julius4/libsent/src/util Message-ID: <1217929854.072125.27442.nullmailer@users.sourceforge.jp> Index: julius4/libsent/src/util/readfile.c diff -u julius4/libsent/src/util/readfile.c:1.3 julius4/libsent/src/util/readfile.c:1.4 --- julius4/libsent/src/util/readfile.c:1.3 Tue May 13 15:32:31 2008 +++ julius4/libsent/src/util/readfile.c Tue Aug 5 18:50:53 2008 @@ -21,7 +21,7 @@ * @author Akinobu LEE * @date Thu Feb 17 16:41:58 2005 * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * */ /* @@ -101,82 +101,6 @@ return NULL; } -/** - * Read one line from a file descriptor. - * Blank line will be skipped. - * - * @param buf [out] data buffer - * @param maxlen [in] maximum length of above - * @param fd [in] file descriptor - * - * @return the buffer @a buf, or NULL on EOF or error. - */ -char * -getl_fd(char *buf, int maxlen, int fd) -{ - int cnt; - char *p; - p = buf; - while(1) { - cnt = read(fd, p, 1); - if (cnt <= 0) return NULL; /* eof or error */ - if (*p == '\n') { - *p = '\0'; - if (p - 1 >= buf && *(p-1) == '\r') *(p-1) = '\0'; - if (buf[0] == '\0') { - p = buf; - continue; - } else { - break; - } - } else { - if (++p >= buf + maxlen) { - jlog("Error: readfile: line too long (> %d)\n", maxlen); - return NULL; - } - } - } - return buf; -} - -/** - * Read one line from a socket descriptor. - * Blank line will be skipped. - * - * @param buf [out] data buffer - * @param maxlen [in] maximum length of above - * @param sd [in] socket descpritor - * - * @return the buffer @a buf, or NULL on EOF or error. - */ -char * -getl_sd(char *buf, int maxlen, int sd) -{ - int cnt; - char *p; - p = buf; - while(1) { - cnt = recv(sd, p, 1, 0); - if (cnt <= 0) return NULL; /* eof or error */ - if (*p == '\n') { - *p = '\0'; - if (p - 1 >= buf && *(p-1) == '\r') *(p-1) = '\0'; - if (buf[0] == '\0') { - p = buf; - continue; - } else { - break; - } - } else { - if (++p >= buf + maxlen) { - jlog("Error: readfile: line too long (> %d)\n", maxlen); - return NULL; - } - } - } - return buf; -} - /* get 1 line input from stdin with prompt */ /* return value: newly allocated buffer */ /* repeat if no input, and */ From sumomo ¡÷ users.sourceforge.jp Tue Aug 5 18:50:54 2008 From: sumomo ¡÷ users.sourceforge.jp (sumomo ¡÷ users.sourceforge.jp) Date: Tue, 05 Aug 2008 18:50:54 +0900 Subject: [Julius-cvs 221] CVS update: julius4/libsent/src/voca Message-ID: <1217929854.225218.27450.nullmailer@users.sourceforge.jp> Index: julius4/libsent/src/voca/voca_load_htkdict.c diff -u julius4/libsent/src/voca/voca_load_htkdict.c:1.3 julius4/libsent/src/voca/voca_load_htkdict.c:1.4 --- julius4/libsent/src/voca/voca_load_htkdict.c:1.3 Tue Dec 18 17:45:54 2007 +++ julius4/libsent/src/voca/voca_load_htkdict.c Tue Aug 5 18:50:54 2008 @@ -19,7 +19,7 @@ * @author Akinobu LEE * @date Fri Feb 18 19:43:06 2005 * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * */ /* @@ -292,7 +292,7 @@ /** - * Top function to read word dictionary via file pointer + * Top function to read word dictionary via file pointer (gzip enabled) * * @param fp [in] file pointer * @param winfo [out] pointer to word dictionary to store the read data. @@ -317,33 +317,9 @@ /** - * Top function to read word dictionary via file descriptor. + * Top function to read word dictionary via normal file pointer. * - * @param fd [in] file descriptor - * @param winfo [out] pointer to word dictionary to store the read data. - * @param hmminfo [in] HTK %HMM definition data. if NULL, phonemes are ignored. - * @param ignore_tri_conv [in] TRUE if triphone conversion is ignored - * - * @return TRUE on success, FALSE on any error word. - */ -boolean -voca_load_htkdict_fd(int fd, WORD_INFO *winfo, HTK_HMM_INFO *hmminfo, boolean ignore_tri_conv) -{ - boolean ret; - - voca_load_start(winfo, hmminfo, ignore_tri_conv); - while(getl_fd(buf, MAXLINELEN, fd) != NULL) { - if (voca_load_line(buf, winfo, hmminfo) == FALSE) break; - } - ret = voca_load_end(winfo); - - return(ret); -} - -/** - * Top function to read word dictionary via socket descriptor. - * - * @param sd [in] socket descriptor + * @param fp [in] file pointer * @param winfo [out] pointer to word dictionary to store the read data. * @param hmminfo [in] HTK %HMM definition data. if NULL, phonemes are ignored. * @param ignore_tri_conv [in] TRUE if triphone conversion is ignored @@ -351,12 +327,12 @@ * @return TRUE on success, FALSE on any error word. */ boolean -voca_load_htkdict_sd(int sd, WORD_INFO *winfo, HTK_HMM_INFO *hmminfo, boolean ignore_tri_conv) +voca_load_htkdict_fp(FILE *fp, WORD_INFO *winfo, HTK_HMM_INFO *hmminfo, boolean ignore_tri_conv) { boolean ret; voca_load_start(winfo, hmminfo, ignore_tri_conv); - while(getl_sd(buf, MAXLINELEN, sd) != NULL) { + while(getl_fp(buf, MAXLINELEN, fp) != NULL) { if (voca_load_line(buf, winfo, hmminfo) == FALSE) break; } ret = voca_load_end(winfo); From sumomo ¡÷ users.sourceforge.jp Wed Aug 6 15:00:33 2008 From: sumomo ¡÷ users.sourceforge.jp (sumomo ¡÷ users.sourceforge.jp) Date: Wed, 06 Aug 2008 15:00:33 +0900 Subject: [Julius-cvs 222] CVS update: julius4/adintool Message-ID: <1218002433.045704.24153.nullmailer@users.sourceforge.jp> Index: julius4/adintool/adintool.c diff -u julius4/adintool/adintool.c:1.2 julius4/adintool/adintool.c:1.3 --- julius4/adintool/adintool.c:1.2 Tue Dec 18 17:45:46 2007 +++ julius4/adintool/adintool.c Wed Aug 6 15:00:32 2008 @@ -35,7 +35,7 @@ * @author Akinobu LEE * @date Wed Mar 23 20:43:32 2005 * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * */ /* @@ -1225,14 +1225,8 @@ /* loop condition check */ is_continues = FALSE; - if (pause_each) { - if (continuous_segment && (ret > 0 || ret == -2)) { - is_continues = TRUE; - } - } else { - if (continuous_segment && ret > 0) { - is_continues = TRUE; - } + if (continuous_segment && (ret > 0 || ret == -2)) { + is_continues = TRUE; } } while (is_continues); /* to the next segment in this input stream */ From sumomo ¡÷ users.sourceforge.jp Thu Aug 7 18:27:35 2008 From: sumomo ¡÷ users.sourceforge.jp (sumomo ¡÷ users.sourceforge.jp) Date: Thu, 07 Aug 2008 18:27:35 +0900 Subject: [Julius-cvs 223] CVS update: julius4/libjulius/src Message-ID: <1218101255.736825.4007.nullmailer@users.sourceforge.jp> Index: julius4/libjulius/src/search_bestfirst_main.c diff -u julius4/libjulius/src/search_bestfirst_main.c:1.6 julius4/libjulius/src/search_bestfirst_main.c:1.7 --- julius4/libjulius/src/search_bestfirst_main.c:1.6 Thu Jun 19 01:22:08 2008 +++ julius4/libjulius/src/search_bestfirst_main.c Thu Aug 7 18:27:35 2008 @@ -35,7 +35,7 @@ * @author Akinobu Lee * @date Thu Sep 08 11:51:12 2005 * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * */ /* @@ -1022,7 +1022,7 @@ if (r->lmtype == LM_DFA) { /* output which grammar the hypothesis belongs to on multiple grammar */ /* determine only by the last word */ - if (multigram_get_all_num(r->lm) > 1) { + if (multigram_get_all_num(r->lm) > 0) { s->gram_id = multigram_get_gram_from_category(r->lm->winfo->wton[hypo->seq[0]], r->lm); } else { s->gram_id = 0; From sumomo ¡÷ users.sourceforge.jp Fri Aug 29 00:16:54 2008 From: sumomo ¡÷ users.sourceforge.jp (sumomo ¡÷ users.sourceforge.jp) Date: Fri, 29 Aug 2008 00:16:54 +0900 Subject: [Julius-cvs 224] CVS update: julius4/julius Message-ID: <1219936614.531616.1472.nullmailer@users.sourceforge.jp> Index: julius4/julius/record.c diff -u julius4/julius/record.c:1.3 julius4/julius/record.c:1.4 --- julius4/julius/record.c:1.3 Fri Mar 28 12:57:45 2008 +++ julius4/julius/record.c Fri Aug 29 00:16:54 2008 @@ -29,7 +29,7 @@ * @author Akinobu Lee * @date Tue Sep 06 14:13:54 2005 * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * */ /* @@ -184,7 +184,6 @@ if (recfile_fp == NULL) { if (! open_error) record_sample_open(recog, dummy); - return; } if (wrwav_data(recfile_fp, speech, samplenum) == FALSE) {