Blame view

egs/fisher_callhome_spanish/s5/local/find_unique_phones.pl 589 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
  #!/usr/bin/env perl
  #Finds unique phones from the basic rules file
  # Copyright 2014  Gaurav Kumar.   Apache 2.0
  
  use utf8;
  
  ($b)=$ARGV[0];
  ($tmpdir)=$ARGV[1];
  open(BB, "<", "$b/basic_rules") || die "Can't open basic rules";
  binmode(BB, ":iso88591");
  open(O, ">$tmpdir/phones") || die "Can't open text file for writing";
  binmode(O, ":utf8");
  my %phones = qw();
  while (<BB>) {
    chomp;
    my @stringComponents = split(/\t/);
    m/->\s(\S+)/;
    my $phone = $1;
    $phone =~ tr/áéíóú/aeiou/;
    $phones{$phone} = 1;
  }
  foreach my $p (keys %phones) {
    print O $p, "
  ";
  }
  #print keys %phones;