add DecoderBase and license

pull/2524/head
Hui Zhang 2 years ago
parent 138b4fe1f0
commit 36af34b293

@ -23,7 +23,7 @@
namespace ppspeech {
class CTCBeamSearch : public DecoderInterface {
class CTCBeamSearch : public DecoderBase {
public:
explicit CTCBeamSearch(const CTCBeamSearchOptions& opts);
~CTCBeamSearch() {}

@ -1,3 +1,4 @@
// Copyright (c) 2020 Mobvoi Inc (Binbin Zhang)
// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
@ -12,6 +13,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// modified from https://github.com/wenet-e2e/wenet/blob/main/runtime/core/decoder/ctc_prefix_beam_search.cc
#pragma once
#include "decoder/ctc_beam_search_opt.h"
@ -21,7 +24,7 @@
namespace ppspeech {
class ContextGraph;
class CTCPrefixBeamSearch : public DecoderInterface {
class CTCPrefixBeamSearch : public DecoderBase {
public:
explicit CTCPrefixBeamSearch(const std::string vocab_path,
const CTCBeamSearchOptions& opts);

@ -13,6 +13,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// modified from https://github.com/wenet-e2e/wenet/blob/main/runtime/core/decoder/ctc_prefix_beam_search.h
#pragma once
#include "base/common.h"

@ -54,7 +54,7 @@ struct TLGDecoderOptions {
}
};
class TLGDecoder : public DecoderInterface {
class TLGDecoder : public DecoderBase {
public:
explicit TLGDecoder(TLGDecoderOptions opts);
~TLGDecoder() = default;

@ -51,7 +51,10 @@ class DecoderInterface {
virtual std::vector<std::pair<double, std::string>> GetNBestPath() = 0;
virtual std::vector<std::pair<double, std::string>> GetNBestPath(int n) = 0;
};
class DecoderBase : public DecoderInterface {
protected:
// start from one
int NumFrameDecoded() { return num_frame_decoded_ + 1; }

@ -1,3 +1,4 @@
// Copyright 2022 Horizon Robotics. All Rights Reserved.
// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
@ -12,6 +13,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// modified from https://github.com/wenet-e2e/wenet/blob/main/runtime/core/decoder/asr_model.cc
#include "nnet/u2_nnet.h"
#ifdef USE_PROFILING

@ -1,3 +1,4 @@
// Copyright 2022 Horizon Robotics. All Rights Reserved.
// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
@ -12,6 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// modified from https://github.com/wenet-e2e/wenet/blob/main/runtime/core/decoder/asr_model.h
#pragma once
#include "base/common.h"

Loading…
Cancel
Save