提交 36af34b2 编写于 作者: H Hui Zhang

add DecoderBase and license

上级 138b4fe1
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
namespace ppspeech { namespace ppspeech {
class CTCBeamSearch : public DecoderInterface { class CTCBeamSearch : public DecoderBase {
public: public:
explicit CTCBeamSearch(const CTCBeamSearchOptions& opts); explicit CTCBeamSearch(const CTCBeamSearchOptions& opts);
~CTCBeamSearch() {} ~CTCBeamSearch() {}
......
// Copyright (c) 2020 Mobvoi Inc (Binbin Zhang)
// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. // Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
...@@ -12,6 +13,8 @@ ...@@ -12,6 +13,8 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// modified from https://github.com/wenet-e2e/wenet/blob/main/runtime/core/decoder/ctc_prefix_beam_search.cc
#pragma once #pragma once
#include "decoder/ctc_beam_search_opt.h" #include "decoder/ctc_beam_search_opt.h"
...@@ -21,7 +24,7 @@ ...@@ -21,7 +24,7 @@
namespace ppspeech { namespace ppspeech {
class ContextGraph; class ContextGraph;
class CTCPrefixBeamSearch : public DecoderInterface { class CTCPrefixBeamSearch : public DecoderBase {
public: public:
explicit CTCPrefixBeamSearch(const std::string vocab_path, explicit CTCPrefixBeamSearch(const std::string vocab_path,
const CTCBeamSearchOptions& opts); const CTCBeamSearchOptions& opts);
......
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// modified from https://github.com/wenet-e2e/wenet/blob/main/runtime/core/decoder/ctc_prefix_beam_search.h
#pragma once #pragma once
#include "base/common.h" #include "base/common.h"
......
...@@ -54,7 +54,7 @@ struct TLGDecoderOptions { ...@@ -54,7 +54,7 @@ struct TLGDecoderOptions {
} }
}; };
class TLGDecoder : public DecoderInterface { class TLGDecoder : public DecoderBase {
public: public:
explicit TLGDecoder(TLGDecoderOptions opts); explicit TLGDecoder(TLGDecoderOptions opts);
~TLGDecoder() = default; ~TLGDecoder() = default;
......
...@@ -51,7 +51,10 @@ class DecoderInterface { ...@@ -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() = 0;
virtual std::vector<std::pair<double, std::string>> GetNBestPath(int n) = 0; virtual std::vector<std::pair<double, std::string>> GetNBestPath(int n) = 0;
};
class DecoderBase : public DecoderInterface {
protected:
// start from one // start from one
int NumFrameDecoded() { return num_frame_decoded_ + 1; } int NumFrameDecoded() { return num_frame_decoded_ + 1; }
......
// Copyright 2022 Horizon Robotics. All Rights Reserved.
// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. // Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
...@@ -12,6 +13,8 @@ ...@@ -12,6 +13,8 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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" #include "nnet/u2_nnet.h"
#ifdef USE_PROFILING #ifdef USE_PROFILING
......
// Copyright 2022 Horizon Robotics. All Rights Reserved.
// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. // Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
...@@ -12,6 +13,7 @@ ...@@ -12,6 +13,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// modified from https://github.com/wenet-e2e/wenet/blob/main/runtime/core/decoder/asr_model.h
#pragma once #pragma once
#include "base/common.h" #include "base/common.h"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册