Blame view

egs/callhome_egyptian/s5/local/callhome_make_spk2gender 659 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
  #!/usr/bin/env python
  
  # Gets the unique speakers from the file created by fsp_make_trans.pl
  # Note that if a speaker appears multiple times, it is categorized as female 
  
  import os
  import sys
  
  tmpFileLocation = 'data/local/tmp/spk2gendertmp'
  
  tmpFile = None
  
  try:
       tmpFile = open(tmpFileLocation)
  except IOError:
      print 'The file spk2gendertmp does not exist. Run fsp_make_trans.pl first?'
  
  speakers = {}
  
  for line in tmpFile:
      comp = line.split(' ')
      if comp[0] in speakers:
          speakers[comp[0]] = "f"
      else:
          speakers[comp[0]] = comp[1]
          
  for speaker, gender in speakers.iteritems():
      print speaker + " " + gender