voice_audio_multi/include/engine/community_models/kroko_asr/tokenizer.h
Fabio c36510c21e
Some checks failed
Linux Build / Linux cpu (push) Has been cancelled
Linux Build / Linux cpu-clang (push) Has been cancelled
Linux Build / Linux vulkan (push) Has been cancelled
mac-build / macOS CPU (push) Has been cancelled
Nix Build / Nix (cpu) (push) Has been cancelled
Nix Build / Nix (vulkan) (push) Has been cancelled
windows-build / Windows CPU (push) Has been cancelled
Initial import: audio.cpp with Orange Pi documentation
2026-11-04 19:05:22 +01:00

25 lines
640 B
C++

#pragma once
#include <cstdint>
#include <string>
#include <vector>
namespace engine::models::kroko_asr {
class KrokoTokenizer {
public:
KrokoTokenizer(std::vector<std::string> pieces, int32_t blank_id, int32_t unk_id);
std::string decode(const std::vector<int32_t> & ids) const;
std::vector<int32_t> encode_hotword(const std::string & text) const;
const std::string & piece(int32_t id) const;
int32_t blank_id() const noexcept;
int32_t vocab_size() const noexcept;
private:
std::vector<std::string> pieces_;
int32_t blank_id_ = 0;
int32_t unk_id_ = 2;
};
} // namespace engine::models::kroko_asr