HTK应用程序

源代码在线查看: get_ndx.prl

软件大小: 2199 K
上传用户: yyjpu
关键词: HTK 应用程序
下载地址: 免注册下载 普通下载 VIP

相关代码

				#!/usr/local/bin/perl
				
				#
				# This script will copy the speaker independent file lists from 
				# RMCD2 to ndx directory.
				#
				# TL 7/1998
				#
				
				push @INC, "$ENV{RMSCRIPTS}";
				require "global.pl";
				
				$ndx_dir = "$RMLIB".'\\ndx';
				if (!-d $ndx_dir) {
					mkdir $ndx_dir, 0755;
				}
				
				chdir ($ndx_dir);
				
				@types = ("*_*.ndx");
				
				$count=0;
				foreach $type (@types) {
					$cmdstr = "$RMCD2"."rm1\\doc\\$type";
					system("dir /S /B $cmdstr > junk");
					open(JUNK, "					while () {        
						chop;
						if ( -f $_ ) {
							system("copy $_ $ndx_dir\\.");
							$count++;
						}
						else {
							print "not a file $_.\n";
						}
					}
				}
				close (JUNK);
				unlink junk;
				if ( $count > 0 ) {
					print "$count files have been copied\n";
				}
				else {
					print "Error: No file was found\n";
				}
				
				
				#We need to strip the adaptation data so there is only one speaker (dms0)
				
				print("\nModifying training data for one speaker (dms0)\n");
				chdir ($ndx_dir);
				
				system("dir /B *dep* > junk");
				
				open(JUNK, "				while () {        
					chop;
					if ( -f $_ ) {
						$outfile = "$_.tmp";
						unless (open (OUTFILE, ">$outfile")) {
							die ("cannot open dir $ndx_dir for writing");
						}
						open (INFILE, $_);
						$filename = $_;
						$filename =~ tr/A-Z/a-z/;
						$count = 0;
						$line = ;
						while ( $line ne "" && $count 							if ( $line =~ /dms0/ ) {
								print OUTFILE ($line);
								#we do not need all 600 sentences for adaptation training.	
								if ( $filename =~ /6a_deptr/ ) {
									$count++;
								}
							}
							$line = ;
						}
						close(OUTFILE);
					}
					else {
						print "not a file $_.\n";
					}
				}
				close (JUNK);
				
				open(JUNK, "				while () {        
					chop;
					system("copy $_.tmp $_");
				}
				close (JUNK);
				
				open(JUNK, "				while () {        
					chop;
				chdir ($ndx_dir);
					$file = "$_.tmp";
					unlink("$_.tmp");
				}
				close (JUNK);
				
				# put all speaker dep test files into a single file.
				
				system("dir /B *deptst* > junk");
				open(JUNK, "				while () {        
					chop;
				print ("$_\n");
					if ( $_ =~ /TST/ ) {
						system ("type $_ >> dms0_tst.ndx");
					}
				}
				close (JUNK);
				
				unlink junk;
				
				
				print("Adaptation scripts modified\n");
							

相关资源