File tree 1 file changed +6
-5
lines changed
1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -182,18 +182,19 @@ def listen_print_loop(recognize_stream):
182
182
183
183
# Display interim results, but with a carriage return at the end of the
184
184
# line, so subsequent lines will overwrite them.
185
- if not result . is_final :
186
- # If the previous result was longer than this one, we need to print
187
- # some extra spaces to overwrite the previous result
188
- overwrite_chars = ' ' * max (0 , num_chars_printed - len (transcript ))
185
+ #
186
+ # If the previous result was longer than this one, we need to print
187
+ # some extra spaces to overwrite the previous result
188
+ overwrite_chars = ' ' * max (0 , num_chars_printed - len (transcript ))
189
189
190
+ if not result .is_final :
190
191
sys .stdout .write (transcript + overwrite_chars + '\r ' )
191
192
sys .stdout .flush ()
192
193
193
194
num_chars_printed = len (transcript )
194
195
195
196
else :
196
- print (transcript )
197
+ print (transcript + overwrite_chars )
197
198
198
199
# Exit recognition if any of the transcribed phrases could be
199
200
# one of our keywords.
You can’t perform that action at this time.
0 commit comments