Blame view

egs/hub4_spanish/s5/local/prepare_data.sh 976 Bytes
8dcb6dfcb   Yannick Estève   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
  #!/bin/bash
  # Copyright (c) 2017, Johns Hopkins University (Jan "Yenda" Trmal<jtrmal@gmail.com>)
  # License: Apache 2.0
  
  # Begin configuration section.
  # End configuration section
  set -e -o pipefail
  set -o nounset             # Treat unset variables as an error
  
  out="${@: -1}"             # last argument of the command line
  corpus="${@:1:$#-1}"    # first to last-1 arguments
  
  mkdir -p $out;
  
  for src in $corpus; do
    if [ -f $src ]; then
      [[ $src == *.sgm ]] && echo "$src"
    else
      find -L $src -iname "*.sgm"
    fi
  done > $out/text.list
  
  for src in $corpus; do
    if [ -f $src ]; then
      [[ $src == *.sph ]] && echo "$src"
    else
      find -L $src -iname "*.sph"
    fi
  done  > $out/audio.list
  
  local/parse_sgm.pl $out/text.list > $out/transcript.txt 2> $out/transcript.log
  
  local/write_kaldi_files.pl $out/audio.list $out/transcript.txt $out
  utils/utt2spk_to_spk2utt.pl $out/utt2spk > $out/spk2utt
  utils/fix_data_dir.sh $out
  utils/validate_data_dir.sh --no-feats $out