diff --git a/speechx/speechx/decoder/ctc_beam_search_decoder.h b/speechx/speechx/decoder/ctc_beam_search_decoder.h index 479754c3689c9fc3f6b684b6321a02d31c93a02c..6347bba87d8d2ec4b782e0626f1f82e1e4f6e2ba 100644 --- a/speechx/speechx/decoder/ctc_beam_search_decoder.h +++ b/speechx/speechx/decoder/ctc_beam_search_decoder.h @@ -23,7 +23,7 @@ namespace ppspeech { -class CTCBeamSearch : public DecoderInterface { +class CTCBeamSearch : public DecoderBase { public: explicit CTCBeamSearch(const CTCBeamSearchOptions& opts); ~CTCBeamSearch() {} diff --git a/speechx/speechx/decoder/ctc_prefix_beam_search_decoder.h b/speechx/speechx/decoder/ctc_prefix_beam_search_decoder.h index eef8823da4aa2522cdf36521b3deb134a1e9c7f5..ef96ecd935cc7919cce9f3f907ac8b3b9c9071e8 100644 --- a/speechx/speechx/decoder/ctc_prefix_beam_search_decoder.h +++ b/speechx/speechx/decoder/ctc_prefix_beam_search_decoder.h @@ -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); diff --git a/speechx/speechx/decoder/ctc_prefix_beam_search_score.h b/speechx/speechx/decoder/ctc_prefix_beam_search_score.h index da2fb80a9d3e0498a2f7f71cb4b74f9dc5e42bff..908be1d69d3ffb1c4ee3063bd93151a17e4d3d38 100644 --- a/speechx/speechx/decoder/ctc_prefix_beam_search_score.h +++ b/speechx/speechx/decoder/ctc_prefix_beam_search_score.h @@ -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" diff --git a/speechx/speechx/decoder/ctc_tlg_decoder.h b/speechx/speechx/decoder/ctc_tlg_decoder.h index cf8a9b7303a48b276f5f6eef5ea1a0d2a970eecf..f250ac25e26fcfb2abbf4b0331401cbd42e51021 100644 --- a/speechx/speechx/decoder/ctc_tlg_decoder.h +++ b/speechx/speechx/decoder/ctc_tlg_decoder.h @@ -54,7 +54,7 @@ struct TLGDecoderOptions { } }; -class TLGDecoder : public DecoderInterface { +class TLGDecoder : public DecoderBase { public: explicit TLGDecoder(TLGDecoderOptions opts); ~TLGDecoder() = default; diff --git a/speechx/speechx/decoder/decoder_itf.h b/speechx/speechx/decoder/decoder_itf.h index eec9bc3d4e0c08c275054af2d9dda54ff47c1de7..2289b3173dca346440ef293ace2fd3ead0a44587 100644 --- a/speechx/speechx/decoder/decoder_itf.h +++ b/speechx/speechx/decoder/decoder_itf.h @@ -51,7 +51,10 @@ class DecoderInterface { virtual std::vector> GetNBestPath() = 0; virtual std::vector> GetNBestPath(int n) = 0; +}; +class DecoderBase : public DecoderInterface { + protected: // start from one int NumFrameDecoded() { return num_frame_decoded_ + 1; } diff --git a/speechx/speechx/nnet/u2_nnet.cc b/speechx/speechx/nnet/u2_nnet.cc index c92c96aaae86af65cd000aae73bea297584a02fd..ff6a4dc37d14bae255e1ea428849c605a8f6a529 100644 --- a/speechx/speechx/nnet/u2_nnet.cc +++ b/speechx/speechx/nnet/u2_nnet.cc @@ -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 diff --git a/speechx/speechx/nnet/u2_nnet.h b/speechx/speechx/nnet/u2_nnet.h index a37a88f2fe6fefb391ce262f7acfd88a8b441120..48dd8193b5f0858827d71a8747f753dda79d9936 100644 --- a/speechx/speechx/nnet/u2_nnet.h +++ b/speechx/speechx/nnet/u2_nnet.h @@ -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"