cati commited on
Commit
8c63197
1 Parent(s): ed9427b
Files changed (2) hide show
  1. app.py +1 -3
  2. vowel_length.py +16 -9
app.py CHANGED
@@ -14,12 +14,10 @@ dat,vck,kws = vowel_length.setup(tsv,ph_key)
14
 
15
 
16
  def manager(word,group,aligner):
17
- fig = vowel_length.runan(word.lower(),group.lower(),aligner.lower(),vck,dat,sources)
18
  return fig
19
 
20
 
21
- css = ".matplotlib {height: 60rem !important; width: 100% !important;}"
22
-
23
  bl = gr.Blocks()
24
  with bl:
25
  gr.Markdown(
 
14
 
15
 
16
  def manager(word,group,aligner):
17
+ fig = vowel_length.runan(word,group,aligner,vck,dat,sources)
18
  return fig
19
 
20
 
 
 
21
  bl = gr.Blocks()
22
  with bl:
23
  gr.Markdown(
vowel_length.py CHANGED
@@ -97,21 +97,28 @@ def displ(prinfo):
97
  # for keyword, speaker-background, align-source,
98
  # vowel/consonant index key, and dataset
99
  def runan(kwd,spl,aln,vck,dat,sources):
 
 
 
 
100
  vcd = vck[aln][kwd]
101
 
102
  if any([ tuple('X') in el for el in vcd.values()]):
103
  #print("EXCLUDED WORD FOR THIS ALIGNMENT TYPE")
104
  return "EXCLUDED WORD FOR THIS ALIGNMENT TYPE"
105
- if spl.lower() == 'l1':
106
- d = [l for l in dat if l[8].lower() == 'icelandic']
107
- if spl.lower() == 'l2':
108
- d = [l for l in dat if l[8].lower() != 'icelandic']
109
- prinfo = get_vc_dur(kwd,aln,dat,vcd,sources[aln])
110
- if len(prinfo) >5:
111
- r,f = displ(prinfo)
112
- return(f)
113
  else:
114
- return 0
 
 
 
 
 
 
 
 
 
 
 
115
  # TODO THIS CASE
116
 
117
 
 
97
  # for keyword, speaker-background, align-source,
98
  # vowel/consonant index key, and dataset
99
  def runan(kwd,spl,aln,vck,dat,sources):
100
+ kwd = kwd.lower()
101
+ spl = spl.lower()
102
+ aln = aln.lower()
103
+ print(kwd,aln,spl,len(dat))
104
  vcd = vck[aln][kwd]
105
 
106
  if any([ tuple('X') in el for el in vcd.values()]):
107
  #print("EXCLUDED WORD FOR THIS ALIGNMENT TYPE")
108
  return "EXCLUDED WORD FOR THIS ALIGNMENT TYPE"
 
 
 
 
 
 
 
 
109
  else:
110
+ if spl == 'l1':
111
+ d = [l for l in dat if l[8].lower() == 'icelandic']
112
+ elif spl == 'l2':
113
+ d = [l for l in dat if l[8].lower() != 'icelandic']
114
+
115
+ print(len(d),'***')
116
+ prinfo = get_vc_dur(kwd,aln,dat,vcd,sources[aln])
117
+ if len(prinfo) >5:
118
+ r,f = displ(prinfo)
119
+ return(f)
120
+ else:
121
+ return 0
122
  # TODO THIS CASE
123
 
124