You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.4 KiB

  1. // Copyright (c) 2020 Mobvoi Inc (Binbin Zhang)
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #ifndef DECODER_SEARCH_INTERFACE_H_
  15. #define DECODER_SEARCH_INTERFACE_H_
  16. namespace wenet {
  17. #include <vector>
  18. enum SearchType {
  19. kPrefixBeamSearch = 0x00,
  20. kWfstBeamSearch = 0x01,
  21. };
  22. class SearchInterface {
  23. public:
  24. virtual ~SearchInterface() {}
  25. virtual void Search(const std::vector<std::vector<float>>& logp) = 0;
  26. virtual void Reset() = 0;
  27. virtual void FinalizeSearch() = 0;
  28. virtual SearchType Type() const = 0;
  29. // N-best inputs id
  30. virtual const std::vector<std::vector<int>>& Inputs() const = 0;
  31. // N-best outputs id
  32. virtual const std::vector<std::vector<int>>& Outputs() const = 0;
  33. // N-best likelihood
  34. virtual const std::vector<float>& Likelihood() const = 0;
  35. // N-best timestamp
  36. virtual const std::vector<std::vector<int>>& Times() const = 0;
  37. };
  38. } // namespace wenet
  39. #endif // DECODER_SEARCH_INTERFACE_H_