chunk at sentence takes now an argument =self.comited
This commit is contained in:
parent
04170153e0
commit
77d43885a3
1 changed files with 10 additions and 7 deletions
|
|
@ -173,9 +173,11 @@ class OnlineASRProcessor:
|
||||||
|
|
||||||
self.transcript_buffer.insert(tsw, self.buffer_time_offset)
|
self.transcript_buffer.insert(tsw, self.buffer_time_offset)
|
||||||
o = self.transcript_buffer.flush()
|
o = self.transcript_buffer.flush()
|
||||||
|
# Completed words
|
||||||
self.commited.extend(o)
|
self.commited.extend(o)
|
||||||
completed = self.to_flush(o)
|
completed = self.to_flush(o)
|
||||||
logger.debug(f">>>>COMPLETE NOW: {completed[2]}")
|
logger.debug(f">>>>COMPLETE NOW: {completed[2]}")
|
||||||
|
## The rest is incomplete
|
||||||
the_rest = self.to_flush(self.transcript_buffer.complete())
|
the_rest = self.to_flush(self.transcript_buffer.complete())
|
||||||
logger.debug(f"INCOMPLETE: {the_rest[2]}")
|
logger.debug(f"INCOMPLETE: {the_rest[2]}")
|
||||||
|
|
||||||
|
|
@ -183,11 +185,12 @@ class OnlineASRProcessor:
|
||||||
|
|
||||||
if self.buffer_trimming_way == "sentence":
|
if self.buffer_trimming_way == "sentence":
|
||||||
|
|
||||||
self.chunk_completed_sentence()
|
self.chunk_completed_sentence(self.commited)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# TODO: new words in `completed` should not be reterned unless they form a sentence
|
||||||
|
# TODO: only complete sentences should go to completed
|
||||||
|
|
||||||
|
|
||||||
if len(self.audio_buffer) / self.SAMPLING_RATE > self.buffer_trimming_sec :
|
if len(self.audio_buffer) / self.SAMPLING_RATE > self.buffer_trimming_sec :
|
||||||
|
|
@ -219,13 +222,13 @@ class OnlineASRProcessor:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return self.to_flush(o)
|
return completed
|
||||||
|
|
||||||
def chunk_completed_sentence(self):
|
def chunk_completed_sentence(self, commited_text):
|
||||||
if self.commited == []:
|
if commited_text == []:
|
||||||
return
|
return
|
||||||
|
|
||||||
sents = self.words_to_sentences(self.commited)
|
sents = self.words_to_sentences(commited_text)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -436,7 +439,7 @@ class VACOnlineASRProcessor(OnlineASRProcessor):
|
||||||
ret = self.online.process_iter()
|
ret = self.online.process_iter()
|
||||||
return ret
|
return ret
|
||||||
else:
|
else:
|
||||||
print("no online update, only VAD", self.status, file=self.logfile)
|
logger.debug("no online update, only VAD")
|
||||||
return (None, None, "")
|
return (None, None, "")
|
||||||
|
|
||||||
def finish(self):
|
def finish(self):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue