@@ -141,7 +141,7 @@ def getOnscreenText(text,style):
141141
142142 text = text .replace (u'\u2019 ' ,"'" )
143143 text = text .encode ('ascii' ,'ignore' )
144- if style == 'Onscreen' :
144+ if not re . match ( '[A-Z][0-9]+' , text ) :
145145 text = re .sub ('[A-Z][0-9,]+' ,'' ,text ).split ('//' )[0 ]
146146
147147 bc = 0
@@ -178,6 +178,7 @@ def getlessonitemstats(itemfn):
178178 avgbranchlength = 0
179179 totalbranchlength = 0
180180 branchcount = 0
181+ corrcount = 0
181182 gotoNR = True
182183 inBranch = False
183184 branchnum = 0
@@ -186,6 +187,7 @@ def getlessonitemstats(itemfn):
186187 longcount = 0
187188 nonstandardsubmittime = 0.
188189 longcustomtime = 0.
190+ avgcorrcount = 0.
189191
190192 for par in doc .paragraphs :
191193 style = par .style
@@ -194,6 +196,8 @@ def getlessonitemstats(itemfn):
194196 for run in par .runs :
195197 if not run .strike :
196198 text += run .text
199+ print style ,
200+ print text .encode ('ascii' ,'ignore' )
197201
198202 if style == 'NoResponse' or style == 'SecondaryNoResponse' : inNR = True
199203 elif style in mainlinestyles : inNR = False
@@ -203,7 +207,9 @@ def getlessonitemstats(itemfn):
203207 elif inNR : inBranch = False
204208
205209 if re .match ('^correct' ,text .lower ()) or re .match ('^incorrect' ,text .lower ()) or re .match ('^no response' ,text .lower ()):
206- branchcount += 1
210+ branchcount += 1
211+ if re .match ('^correct' ,text .lower ()):
212+ corrcount += 1
207213 if inBranch or inNR or not style in mainlinestyles :
208214 if re .match ('[A-Z][0-9]+' ,text ):
209215 btext = text .replace (u'\u2019 ' ,"'" )
@@ -235,6 +241,7 @@ def getlessonitemstats(itemfn):
235241 branchnum += 1
236242 totalbranchlength = getLength (branchtext ,itemfn .replace ('.docx' ,"-branch" + str (branchnum ) + ".wav" ))
237243 avgbranchlength += totalbranchlength / branchcount
244+ avgcorrcount += corrcount
238245 branchtext = ''
239246 branchcount = 0
240247
@@ -257,6 +264,7 @@ def getlessonitemstats(itemfn):
257264 MLtext += temp [0 ]
258265 NRtext += temp [1 ]
259266
267+ if branchnum > 0 : avgcorrcount /= branchnum
260268 TTStime = getLength (doctext ,wavfn )
261269 MLtime = getLength (MLtext ,wavfn .replace ('.wav' ,'-main.wav' ))
262270 NRtime = getLength (NRtext ,wavfn .replace ('.wav' ,'-NR.wav' ))
@@ -278,5 +286,7 @@ def getlessonitemstats(itemfn):
278286 'medium count' : medcount ,
279287 'long count' : longcount ,
280288 'nonstandard submit time' : nonstandardsubmittime ,
281- 'long submit time' : longcustomtime
289+ 'long submit time' : longcustomtime ,
290+ 'corrects per branch' : avgcorrcount ,
291+ 'branch count' : branchnum ,
282292 }
0 commit comments