This repository has been archived on 2025-08-26. You can view files and clone it, but cannot push or open issues or pull requests.
Files
enginex-mr_series-sherpa-onnx/sherpa-onnx/csrc/online-transducer-modified-beam-search-decoder.h
Fangjun Kuang 7f72c13d9a Code refactoring (#74)
* Don't reset model state and feature extractor on endpointing

* support passing decoding_method from commandline

* Add modified_beam_search to Python API

* fix C API example

* Fix style issues
2023-03-03 12:10:59 +08:00

40 lines
1.3 KiB
C++

// sherpa-onnx/csrc/online-transducer-modified_beam-search-decoder.h
//
// Copyright (c) 2023 Pingfeng Luo
// Copyright (c) 2023 Xiaomi Corporation
#ifndef SHERPA_ONNX_CSRC_ONLINE_TRANSDUCER_MODIFIED_BEAM_SEARCH_DECODER_H_
#define SHERPA_ONNX_CSRC_ONLINE_TRANSDUCER_MODIFIED_BEAM_SEARCH_DECODER_H_
#include <vector>
#include "sherpa-onnx/csrc/online-transducer-decoder.h"
#include "sherpa-onnx/csrc/online-transducer-model.h"
namespace sherpa_onnx {
class OnlineTransducerModifiedBeamSearchDecoder
: public OnlineTransducerDecoder {
public:
OnlineTransducerModifiedBeamSearchDecoder(OnlineTransducerModel *model,
int32_t max_active_paths)
: model_(model), max_active_paths_(max_active_paths) {}
OnlineTransducerDecoderResult GetEmptyResult() const override;
void StripLeadingBlanks(OnlineTransducerDecoderResult *r) const override;
void Decode(Ort::Value encoder_out,
std::vector<OnlineTransducerDecoderResult> *result) override;
void UpdateDecoderOut(OnlineTransducerDecoderResult *result) override;
private:
OnlineTransducerModel *model_; // Not owned
int32_t max_active_paths_;
};
} // namespace sherpa_onnx
#endif // SHERPA_ONNX_CSRC_ONLINE_TRANSDUCER_MODIFIED_BEAM_SEARCH_DECODER_H_