Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
TensorSpeech
GitHub Repository: TensorSpeech/TensorFlowTTS
Path: blob/master/examples/cpptflite/src/TTSFrontend.h
1559 views
1
#ifndef TTSFRONTEND_H
2
#define TTSFRONTEND_H
3
4
#include <iostream>
5
#include <string>
6
#include <vector>
7
#include <regex>
8
#include <stdio.h>
9
10
class TTSFrontend
11
{
12
public:
13
14
/**
15
* Converting text to phoneIDs.
16
* A tmporary method using command to process text in this demo,
17
* which should to be replaced by a pronunciation processing module.
18
*@param strCmd Command to call the method of processor.text_to_sequence()
19
*/
20
TTSFrontend(const std::string &mapperJson,
21
const std::string &strCmd):
22
_mapperJson(mapperJson),
23
_strCmd(strCmd)
24
{
25
std::cout << "TTSFrontend Init" << std::endl;
26
std::cout << _mapperJson << std::endl;
27
std::cout << _strCmd << std::endl;
28
};
29
30
void text2ids(const std::string &text);
31
32
std::vector<int32_t> getPhoneIds() const {return _phonesIds;}
33
private:
34
35
const std::string _mapperJson;
36
const std::string _strCmd;
37
38
std::vector<int32_t> _phonesIds;
39
40
std::string getCmdResult(const std::string &text);
41
std::vector<int32_t> strSplit(const std::string &idStr);
42
};
43
44
#endif // TTSFRONTEND_H
45