voice_audio_multi/include/engine/models/supertonic/tokenizer_text.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

31 lines
792 B
C++

#pragma once
#include "engine/models/supertonic/assets.h"
#include <cstdint>
#include <memory>
#include <string>
#include <vector>
namespace engine::models::supertonic {
struct SupertonicTextInputs {
std::vector<int64_t> ids;
std::vector<float> mask;
int64_t length = 0;
};
class SupertonicTextTokenizer {
public:
explicit SupertonicTextTokenizer(std::shared_ptr<const SupertonicAssets> assets);
SupertonicTextInputs encode(const std::string & text, const std::string & language) const;
private:
std::string preprocess(const std::string & text, const std::string & language) const;
std::vector<uint32_t> utf8_to_codepoints(const std::string & text) const;
std::shared_ptr<const SupertonicAssets> assets_;
};
} // namespace engine::models::supertonic