Skip to content

Commit

Permalink
Move extern to static
Browse files Browse the repository at this point in the history
  • Loading branch information
synesthesiam committed Sep 10, 2023
1 parent 9b18c02 commit 64c1553
Show file tree
Hide file tree
Showing 6 changed files with 199 additions and 375 deletions.
11 changes: 0 additions & 11 deletions .dockerignore

This file was deleted.

125 changes: 0 additions & 125 deletions Dockerfile

This file was deleted.

50 changes: 8 additions & 42 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,44 +1,10 @@
.PHONY: release release-windows test python python-test docker docker-windows
.PHONY: clean

LIB_DIR := lib/Linux-$(shell uname -m)
DOCKER_PLATFORM ?= linux/amd64,linux/arm64,linux/arm/v7
VENV ?= .venv
all:
cmake -Bbuild -DCMAKE_INSTALL_PREFIX=install
cmake --build build --config Release
cd build && ctest --config Release
cmake --install install

release:
mkdir -p build
cd build && cmake .. -DCMAKE_BUILD_TYPE=Release && make
cp -a espeak-ng/build/lib/libespeak*.so* build/
cp -R espeak-ng/build/share/espeak-ng-data build/
cp -a $(LIB_DIR)/onnxruntime/lib/libonnxruntime*.so* build/
cp etc/libtashkeel_model.ort build/

release-windows:
mkdir -p build
cd build && cmake .. -DCMAKE_BUILD_TYPE=Release && make
cp -a espeak-ng/build_windows/lib/libespeak*.dll build/
cp -R espeak-ng/build/share/espeak-ng-data build/
cp -a $(LIB_DIR)/onnxruntime/lib/libonnxruntime*.dll build/
cp etc/libtashkeel_model.ort build/

test:
g++ -Wall -o test -Iespeak-ng/build/include -Lespeak-ng/build/lib -I$(LIB_DIR)/onnxruntime/include -L$(LIB_DIR)/onnxruntime/lib -Isrc -std=c++17 src/test.cpp src/phonemize.cpp src/phoneme_ids.cpp src/tashkeel.cpp src/shared.cpp -lespeak-ng -lonnxruntime
LD_LIBRARY_PATH="espeak-ng/build/lib:$(LIB_DIR)/onnxruntime/lib:${LD_LIBRARY_PATH}" ./test 'espeak-ng/build/share/espeak-ng-data'

python:
cp -R espeak-ng/build/share/espeak-ng-data piper_phonemize/
cp etc/libtashkeel_model.ort piper_phonemize/
LD_LIBRARY_PATH="espeak-ng/build/lib:${LD_LIBRARY_PATH}" "$(VENV)/bin/pip3" install -e .

python-test:
LD_LIBRARY_PATH="espeak-ng/build/lib:$(LIB_DIR)/onnxruntime/lib:${LD_LIBRARY_PATH}" "$(VENV)/bin/python3" src/python_test.py

python-wheel:
cp -R espeak-ng/build/share/espeak-ng-data piper_phonemize/
cp etc/libtashkeel_model.ort piper_phonemize/
LD_LIBRARY_PATH="espeak-ng/build/lib:${LD_LIBRARY_PATH}" "$(VENV)/bin/python3" setup.py bdist_wheel

docker:
docker buildx build . --platform "$(DOCKER_PLATFORM)" --output 'type=local,dest=dist'

docker-windows:
docker buildx build . -f Dockerfile.windows --output 'type=local,dest=dist/windows_amd64'
clean:
rm -rf build install
1 change: 0 additions & 1 deletion espeak-ng
Submodule espeak-ng deleted from 6fd183
192 changes: 0 additions & 192 deletions src/phoneme_ids.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,198 +6,6 @@

namespace piper {

PIPERPHONEMIZE_EXPORT const size_t MAX_PHONEMES = 256;
PIPERPHONEMIZE_EXPORT PhonemeIdMap DEFAULT_PHONEME_ID_MAP = {
{U'_', {0}},
{U'^', {1}},
{U'$', {2}},
{U' ', {3}},
{U'!', {4}},
{U'\'', {5}},
{U'(', {6}},
{U')', {7}},
{U',', {8}},
{U'-', {9}},
{U'.', {10}},
{U':', {11}},
{U';', {12}},
{U'?', {13}},
{U'a', {14}},
{U'b', {15}},
{U'c', {16}},
{U'd', {17}},
{U'e', {18}},
{U'f', {19}},
{U'h', {20}},
{U'i', {21}},
{U'j', {22}},
{U'k', {23}},
{U'l', {24}},
{U'm', {25}},
{U'n', {26}},
{U'o', {27}},
{U'p', {28}},
{U'q', {29}},
{U'r', {30}},
{U's', {31}},
{U't', {32}},
{U'u', {33}},
{U'v', {34}},
{U'w', {35}},
{U'x', {36}},
{U'y', {37}},
{U'z', {38}},
{U'æ', {39}},
{U'ç', {40}},
{U'ð', {41}},
{U'ø', {42}},
{U'ħ', {43}},
{U'ŋ', {44}},
{U'œ', {45}},
{U'ǀ', {46}},
{U'ǁ', {47}},
{U'ǂ', {48}},
{U'ǃ', {49}},
{U'ɐ', {50}},
{U'ɑ', {51}},
{U'ɒ', {52}},
{U'ɓ', {53}},
{U'ɔ', {54}},
{U'ɕ', {55}},
{U'ɖ', {56}},
{U'ɗ', {57}},
{U'ɘ', {58}},
{U'ə', {59}},
{U'ɚ', {60}},
{U'ɛ', {61}},
{U'ɜ', {62}},
{U'ɞ', {63}},
{U'ɟ', {64}},
{U'ɠ', {65}},
{U'ɡ', {66}},
{U'ɢ', {67}},
{U'ɣ', {68}},
{U'ɤ', {69}},
{U'ɥ', {70}},
{U'ɦ', {71}},
{U'ɧ', {72}},
{U'ɨ', {73}},
{U'ɪ', {74}},
{U'ɫ', {75}},
{U'ɬ', {76}},
{U'ɭ', {77}},
{U'ɮ', {78}},
{U'ɯ', {79}},
{U'ɰ', {80}},
{U'ɱ', {81}},
{U'ɲ', {82}},
{U'ɳ', {83}},
{U'ɴ', {84}},
{U'ɵ', {85}},
{U'ɶ', {86}},
{U'ɸ', {87}},
{U'ɹ', {88}},
{U'ɺ', {89}},
{U'ɻ', {90}},
{U'ɽ', {91}},
{U'ɾ', {92}},
{U'ʀ', {93}},
{U'ʁ', {94}},
{U'ʂ', {95}},
{U'ʃ', {96}},
{U'ʄ', {97}},
{U'ʈ', {98}},
{U'ʉ', {99}},
{U'ʊ', {100}},
{U'ʋ', {101}},
{U'ʌ', {102}},
{U'ʍ', {103}},
{U'ʎ', {104}},
{U'ʏ', {105}},
{U'ʐ', {106}},
{U'ʑ', {107}},
{U'ʒ', {108}},
{U'ʔ', {109}},
{U'ʕ', {110}},
{U'ʘ', {111}},
{U'ʙ', {112}},
{U'ʛ', {113}},
{U'ʜ', {114}},
{U'ʝ', {115}},
{U'ʟ', {116}},
{U'ʡ', {117}},
{U'ʢ', {118}},
{U'ʲ', {119}},
{U'ˈ', {120}},
{U'ˌ', {121}},
{U'ː', {122}},
{U'ˑ', {123}},
{U'˞', {124}},
{U'β', {125}},
{U'θ', {126}},
{U'χ', {127}},
{U'', {128}},
{U'', {129}},

// tones
{U'0', {130}},
{U'1', {131}},
{U'2', {132}},
{U'3', {133}},
{U'4', {134}},
{U'5', {135}},
{U'6', {136}},
{U'7', {137}},
{U'8', {138}},
{U'9', {139}},
{U'\u0327', {140}}, // combining cedilla
{U'\u0303', {141}}, // combining tilde
{U'\u032a', {142}}, // combining bridge below
{U'\u032f', {143}}, // combining inverted breve below
{U'\u0329', {144}}, // combining vertical line below
{U'ʰ', {145}},
{U'ˤ', {146}},
{U'ε', {147}},
{U'', {148}},
{U'#', {149}}, // Icelandic
{U'\"', {150}}, // Russian

{U'', {151}},

// Basque
{U'\u033a', {152}},
{U'\u033b', {153}},

// Luxembourgish
{U'g', {154}},
{U'ʦ', {155}},
{U'X', {156}},

// Czech
{U'\u031d', {157}},
{U'\u030a', {158}},
};

// language -> phoneme -> [id, ...]
PIPERPHONEMIZE_EXPORT std::map<std::string, PhonemeIdMap> DEFAULT_ALPHABET = {
// Ukrainian
{"uk",
{
{U'_', {0}}, {U'^', {1}}, {U'$', {2}}, {U' ', {3}},
{U'!', {4}}, {U'\'', {5}}, {U',', {6}}, {U'-', {7}},
{U'.', {8}}, {U':', {9}}, {U';', {10}}, {U'?', {11}},
{U'а', {12}}, {U'б', {13}}, {U'в', {14}}, {U'г', {15}},
{U'ґ', {16}}, {U'д', {17}}, {U'е', {18}}, {U'є', {19}},
{U'ж', {20}}, {U'з', {21}}, {U'и', {22}}, {U'і', {23}},
{U'ї', {24}}, {U'й', {25}}, {U'к', {26}}, {U'л', {27}},
{U'м', {28}}, {U'н', {29}}, {U'о', {30}}, {U'п', {31}},
{U'р', {32}}, {U'с', {33}}, {U'т', {34}}, {U'у', {35}},
{U'ф', {36}}, {U'х', {37}}, {U'ц', {38}}, {U'ч', {39}},
{U'ш', {40}}, {U'щ', {41}}, {U'ь', {42}}, {U'ю', {43}},
{U'я', {44}}, {U'\u0301', {45}}, {U'\u0306', {46}}, {U'\u0308', {47}},
{U'', {48}},
}}};

PIPERPHONEMIZE_EXPORT void
phonemes_to_ids(const std::vector<Phoneme> &phonemes, PhonemeIdConfig &config,
std::vector<PhonemeId> &phonemeIds,
Expand Down
Loading

0 comments on commit 64c1553

Please sign in to comment.