Blame view

egs/chime1/s5/local/create_chime1_grammar.pl 1.88 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
  #!/usr/bin/env perl
  #
  # Copyright 2015  University of Sheffield (Author: Ning Ma)
  # Apache 2.0.
  #
  # Prepare a simple grammar G.fst for the GRID corpus (CHiME 1/2)
  # with silence at the beginning and the end of each utterance.
  #
  
  use strict;
  use warnings;
  
  # GRID has the following grammar:
  # verb=bin|lay|place|set
  # colour=blue|green|red|white
  # prep=at|by|in|with
  # letter=a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|x|y|z
  # digit=zero|one|two|three|four|five|six|seven|eight|nine
  # coda=again|now|please|soon
  # sil $verb $colour $prep $letter $digit $coda sil
  
  my $state = 0;
  my $state2 = $state + 1;
  #my $sil = "<SIL>";
  #print "$state $state2 $sil $sil 0.0
  ";
  
  #$state++;
  #$state2 = $state + 1;
  my @words = ("BIN", "LAY", "PLACE", "SET");
  my $nWords = @words;
  my $penalty = -log(1.0/$nWords);
  foreach (@words) { print "$state $state2 $_ $_ $penalty
  "; }
  
  $state++;
  $state2 = $state + 1;
  @words = ("BLUE", "GREEN", "RED", "WHITE");
  $nWords = @words;
  $penalty = -log(1.0/$nWords);
  foreach (@words) { print "$state $state2 $_ $_ $penalty
  "; }
  
  $state++;
  $state2 = $state + 1;
  @words = ("AT", "BY", "IN", "WITH");
  $nWords = @words;
  $penalty = -log(1.0/$nWords);
  foreach (@words) { print "$state $state2 $_ $_ $penalty
  "; }
  
  $state++;
  $state2 = $state + 1;
  @words = ("A".."V", "X", "Y", "Z");
  $nWords = @words;
  $penalty = -log(1.0/$nWords);
  foreach (@words) { print "$state $state2 $_ $_ $penalty
  "; }
  
  $state++;
  $state2 = $state + 1;
  @words = ("ZERO", "ONE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN", "EIGHT", "NINE");
  $nWords = @words;
  $penalty = -log(1.0/$nWords);
  foreach (@words) { print "$state $state2 $_ $_ $penalty
  "; }
  
  $state++;
  $state2 = $state + 1;
  @words = ("AGAIN", "NOW", "PLEASE", "SOON");
  $nWords = @words;
  $penalty = -log(1.0/$nWords);
  foreach (@words) { print "$state $state2 $_ $_ $penalty
  "; }
  
  #$state++;
  #$state2 = $state + 1;
  #print "$state $state2 $sil $sil 0.0
  ";
  
  print "$state2 0.0
  ";