sumom****@users*****
sumom****@users*****
2008年 9月 30日 (火) 12:58:19 JST
Index: julius4/mkbinhmm/Makefile.in diff -u julius4/mkbinhmm/Makefile.in:1.3 julius4/mkbinhmm/Makefile.in:1.4 --- julius4/mkbinhmm/Makefile.in:1.3 Thu Sep 25 13:49:05 2008 +++ julius4/mkbinhmm/Makefile.in Tue Sep 30 12:58:18 2008 @@ -3,7 +3,7 @@ # Copyright (c) 2005-2007 Julius project team, Nagoya Institute of Technology # All rights reserved # -# $Id: Makefile.in,v 1.3 2008/09/25 04:49:05 sumomo Exp $ +# $Id: Makefile.in,v 1.4 2008/09/30 03:58:18 sumomo Exp $ # SHELL=/bin/sh .SUFFIXES: @@ -21,35 +21,39 @@ exec_prefix=@exec_prefix@ INSTALL=@INSTALL@ -OBJ=mkbinhmm.o -TARGET=mkbinhmm +all: mkbinhmm mkbinhmmlist -all: $(TARGET) +mkbinhmm: mkbinhmm.o $(LIBSENT)/libsent.a + $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ mkbinhmm.o $(LDFLAGS) -$(TARGET): $(OBJ) $(LIBSENT)/libsent.a - $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $(OBJ) $(LDFLAGS) +mkbinhmmlist: mkbinhmmlist.o $(LIBSENT)/libsent.a + $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ mkbinhmmlist.o $(LDFLAGS) install: install.bin install.man -install.bin: $(TARGET) +install.bin: mkbinhmm mkbinhmmlist ${INSTALL} -d @bindir@ - @INSTALL_PROGRAM@ $(TARGET) @bindir@ + @INSTALL_PROGRAM@ mkbinhmm mkbinhmmlist @bindir@ install.man: ${INSTALL} -d @mandir@/man1 - @INSTALL_DATA@ $(TARGET).man @mandir@/man1/$(TARGET).1 + @INSTALL_DATA****@mkbin***** @mandir@/man1/mkbinhmm.1 + @INSTALL_DATA****@mkbin***** @mandir@/man1/mkbinhmmlist.1 install.man.ja: ${INSTALL} -d @mandir@/man1 - @INSTALL_DATA@ $(TARGET).man.ja @mandir@/man1/$(TARGET).1 + @INSTALL_DATA****@mkbin***** @mandir@/man1/mkbinhmm.1 + @INSTALL_DATA****@mkbin***** @mandir@/man1/mkbinhmmlist.1 clean: - $(RM) $(OBJ) + $(RM) mkbinhmm.o mkbinhmmlist.o $(RM) *~ core - $(RM) $(TARGET) $(TARGET).exe + $(RM) mkbinhmm mkbinhmm.exe + $(RM) mkbinhmmlist mkbinhmmlist.exe distclean: - $(RM) $(OBJ) + $(RM) mkbinhmm.o mkbinhmmlist.o $(RM) *~ core - $(RM) $(TARGET) $(TARGET).exe + $(RM) mkbinhmm mkbinhmm.exe + $(RM) mkbinhmmlist mkbinhmmlist.exe $(RM) Makefile Index: julius4/mkbinhmm/mkbinhmm.c diff -u julius4/mkbinhmm/mkbinhmm.c:1.3 julius4/mkbinhmm/mkbinhmm.c:1.4 --- julius4/mkbinhmm/mkbinhmm.c:1.3 Mon Jul 7 14:50:12 2008 +++ julius4/mkbinhmm/mkbinhmm.c Tue Sep 30 12:58:18 2008 @@ -7,7 +7,7 @@ /* mkbinhmm --- read in ascii hmmdefs file and write in binary format */ -/* $Id: mkbinhmm.c,v 1.3 2008/07/07 05:50:12 sumomo Exp $ */ +/* $Id: mkbinhmm.c,v 1.4 2008/09/30 03:58:18 sumomo Exp $ */ #include <sent/stddefs.h> #include <sent/htk_hmm.h> @@ -21,7 +21,7 @@ usage(char *s) { printf("mkbinhmm: convert HMM definition file to binary format for Julius\n"); - printf("usage: %s [-C HTKConfig] hmmdefs binhmm\n", s); + printf("usage: %s [-htkconf HTKConfig] hmmdefs binhmm\n", s); printf("\nLibrary configuration: "); confout_version(stdout); confout_am(stdout); Index: julius4/mkbinhmm/mkbinhmmlist.c diff -u /dev/null julius4/mkbinhmm/mkbinhmmlist.c:1.1 --- /dev/null Tue Sep 30 12:58:19 2008 +++ julius4/mkbinhmm/mkbinhmmlist.c Tue Sep 30 12:58:18 2008 @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2003-2007 Kawahara Lab., Kyoto University + * Copyright (c) 2003-2005 Shikano Lab., Nara Institute of Science and Technology + * Copyright (c) 2005-2007 Julius project team, Nagoya Institute of Technology + * All rights reserved + */ + +/* mkbinhmmlist --- read in ascii hmmlist file and write in binary format */ + +/* $Id: mkbinhmmlist.c,v 1.1 2008/09/30 03:58:18 sumomo Exp $ */ + +#include <sent/stddefs.h> +#include <sent/htk_hmm.h> + + +HTK_HMM_INFO *hmminfo; +Value para, para_htk; + + +static void +usage(char *s) +{ + printf("mkbinhmmlist: convert HMMList file to binary format for Julius\n"); + printf("usage: %s hmmdefs hmmlist binhmmlist\n", s); + printf("\nLibrary configuration: "); + confout_version(stdout); + confout_am(stdout); + printf("\n"); +} + + +int +main(int argc, char *argv[]) +{ + FILE *fp; + char *hmmdefs_file; + char *hmmlist_file; + char *outfile; + int i; + + hmmdefs_file = hmmlist_file = outfile = NULL; + for(i=1;i<argc;i++) { + if (hmmdefs_file == NULL) { + hmmdefs_file = argv[i]; + } else if (hmmlist_file == NULL) { + hmmlist_file = argv[i]; + } else if (outfile == NULL) { + outfile = argv[i]; + } else { + usage(argv[0]); + return -1; + } + } + if (hmmdefs_file == NULL || hmmlist_file == NULL || outfile == NULL) { + usage(argv[0]); + return -1; + } + + hmminfo = hmminfo_new(); + + printf("---- reading hmmdefs ----\n"); + printf("filename: %s\n", hmmdefs_file); + + /* read hmmdef file */ + undef_para(¶); + if (init_hmminfo(hmminfo, hmmdefs_file, hmmlist_file, ¶) == FALSE) { + fprintf(stderr, "--- terminated\n"); + return -1; + } + + printf("\n------------------------------------------------------------\n"); + print_hmmdef_info(stdout, hmminfo); + printf("\n"); + + printf("------------------------------------------------------------\n"); + + printf("---- writing ----\n"); + printf("filename: %s\n", outfile); + + if ((fp = fopen_writefile(outfile)) == NULL) { + fprintf(stderr, "failed to open %s for writing\n", outfile); + return -1; + } + if (save_hmmlist_bin(fp, hmminfo) == FALSE) { + fprintf(stderr, "failed to write to %s\n", outfile); + return -1; + } + if (fclose_writefile(fp) != 0) { + fprintf(stderr, "failed to close %s\n", outfile); + return -1; + } + + printf("\n"); + printf("binary HMMList written to \"%s\"\n", outfile); + + return 0; +}