Speech:LinkTransAudio.pl

=Summary= Title: linkTransAudio.pl Authors: Jon Shallow -- Modeling Group SP16 Location: /mnt/main/scripts/user/ /mnt/main/scripts/user/History/linkTransAudio/2 /mnt/main/scripts/user/History/linkTransAudio/cur Called by: genFeats.pl v6 Usage: linkTransAudio.pl  Example: linkTransAudio.pl 001_train.fileids mfc /mnt/main/corpus/switchboard/full/audio/trans

=Description=

This script is used to create the utterance file links for new corpora. You must run it from the appropriate utterance directory. It takes a transcript file and the utterance source directory you want to link to. It searches the transcript and creates a link in the appropriate utterance directory to the respective utterance file in the src directory for every line in the transcript file.

For example: To create utterance links for my dev.trans files, I cd in corpus_name/test/audio/utt and run "perl /mnt/main/scripts/user/linkTransAudio.pl ../../trans/dev.trans /mnt/main/corpus/switchboard/full/train/audio/utt/

Make sure you have the trailing forward slash on the. This will create the links in the test/audio/utt folder to the switchboard/full/train/audio/utt/ files that the dev.trans has as it's first token in each line.

=Code=
 * 1) !usr/bin/perl
 * 2) Purpose: creates softlinks from a transcript file to the appropriate utterances or feats
 * 3) in the src directory. Links are place in the directory
 * 4) from which the script is run in
 * 5) Used in genFeats.pl current version as of 4/21/2016
 * Use: linkTransAudio.pl  
 * 1) Example: linkTransAudio.pl 001_train.fileids mfc /mnt/main/corpus/switchboard/corpus/full/train/audio/mcf
 * Use: linkTransAudio.pl  
 * 1) Example: linkTransAudio.pl 001_train.fileids mfc /mnt/main/corpus/switchboard/corpus/full/train/audio/mcf
 * 1) Example: linkTransAudio.pl 001_train.fileids mfc /mnt/main/corpus/switchboard/corpus/full/train/audio/mcf

$transcript = "etc/$ARGV[0]"; #21-Apr-Jon-S added 'etc/' before transcript arg since this is now designed to be ran from top level subexperiment directory $ext = $ARGV[1]; $src_directory = $ARGV[2];

open FIN, "<", $transcript or die ("Fatal Error: Can not open $transcript!\n"); print "Creating links, this may take a few minutes for large transcripts\n"; while (my $entry = ){ my @line = split ' ', $entry; #create links from transcript file to full corpus utts #syntax: ln -s   $target_file = $src_directory."$line[0].$ext"; $cmd = "ln -s -v $target_file feat/$line[0].$ext"; #21-Apr-Jon-S added 'feat/', puts generated links in feat folder as opposed to in same directory #print($cmd."\n"); system($cmd); } print "Complete!\n";