Skip to content

Conversation

@xiaohui-zhang
Copy link
Contributor

…ing bash's string syntax, since OS X sed doesn't recognize \t as a tab.

…ing bash's string syntax, since OS X sed doesn't recognize \t as a tab.
sid2=`printf "s%02d" $sid`
ls -1 $wav_train/id$sid/*.wav \
| sed "s/\(.*\)\/\(.*\).wav/${sid2}_\2\t\1\/\2.wav/" \
| sed $"s/\(.*\)\/\(.*\).wav/${sid2}_\2\t\1\/\2.wav/" \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not right: the dollar sign syntax doesn't work with double-quotes, and with single-quotes the backslash-then-digit things won't work right. I suggest to do
tab=$'\t'
and then use $tab instead of \t.

@xiaohui-zhang
Copy link
Contributor Author

fixed. thanks

# Create utt2spk files
# No speaker ID
sed 's/\(.*\)\t.*/\1\t\1/' < "$scp" > "$data/$x/utt2spk"
sed $'s/\(.*\)\t.*/\1\t\1/' < "$scp" > "$data/$x/utt2spk"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this won't work, the backslash-1 disappears.

# No speaker ID
sed 's/\(.*\)\t.*/\1\t\1/' < "$scp" > "$data/$x/utt2spk"
tab=$'\t'
sed "s/\(.*\)\t.*/\1${tab}\1/" < "$scp" > "$data/$x/utt2spk"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you missed a \t.

# Use speaker ID
#sed "s/\(s..\)\(.*\)\t.*/\1\2\t\1/" < "$scp" > "$data/$x/utt2spk"
# tab=$'\t'
# sed "s/\(s..\)\(.*\)\t.*/\1\2${tab}\1/" < "$scp" > "$data/$x/utt2spk"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better fix this one too although it's commented.

@danpovey
Copy link
Contributor

Thanks! merging.

@danpovey danpovey merged commit 5fbdc66 into kaldi-asr:master Oct 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants