This repository was archived by the owner on Aug 3, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -259,7 +259,7 @@ BeamDecoder::~BeamDecoder()
259259}
260260
261261
262- void BeamDecoder::reset (bool partial /* default = false */ )
262+ void BeamDecoder::reset (bool keep_offset /* default = false*/ , bool keep_words /* default = false */ )
263263{
264264 // init prefixes' root
265265 if (root != nullptr ) {
@@ -279,15 +279,20 @@ void BeamDecoder::reset(bool partial /* default = false */)
279279 root->set_matcher (matcher);
280280 }
281281
282- if (partial) {
282+ if (keep_offset) {
283+ prev_time_offset += last_decoded_timestep + time_offset;
284+ } else {
285+ prev_time_offset = 0 ;
286+ }
287+
288+ if (keep_words) {
283289 prev_wordlist.insert (
284290 std::end (prev_wordlist), std::begin (wordlist),
285291 std::end (wordlist));
286- prev_time_offset += last_decoded_timestep + time_offset;
287292 } else {
288293 prev_wordlist.clear ();
289- prev_time_offset = 0 ;
290294 }
295+
291296 wordlist.clear ();
292297 time_offset = 0 ;
293298 last_decoded_timestep = 0 ;
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ class BeamDecoder {
5151 void set_start_offset (int offset) { time_offset = offset; }
5252
5353 // reset state
54- void reset (bool partial = false );
54+ void reset (bool keep_offset = false , bool keep_words = false );
5555
5656private:
5757 Scorer *ext_scorer;
You can’t perform that action at this time.
0 commit comments