diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d325a7..1a6560d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,7 @@ add_library( babylon SHARED src/babylon.cpp + src/cleaners.cpp src/phonemizer.cpp src/voice.cpp ) diff --git a/include/babylon.hpp b/include/babylon.hpp index 06fc59e..167809c 100644 --- a/include/babylon.hpp +++ b/include/babylon.hpp @@ -50,6 +50,8 @@ namespace DeepPhonemizer { std::vector g2p_internal(const std::string& text); }; + + std::vector numbers_to_words(const std::string& text); } namespace Vits { diff --git a/src/numbers_to_words.hpp b/src/cleaners.cpp similarity index 78% rename from src/numbers_to_words.hpp rename to src/cleaners.cpp index 454a63d..a0eb5b6 100644 --- a/src/numbers_to_words.hpp +++ b/src/cleaners.cpp @@ -134,31 +134,33 @@ std::string hundreds_to_words(int hundreds) { return result; } -std::vector numbers_to_words(const std::string& text) { - std::vector result; - std::vector parts = split_into_threes(text); - std::vector suffixes = { - "thousand", - "million", - "billion", - "trillion", - "quadrillion", - "quintillion", - "sextillion", - "septillion", - "octillion", - "nonillion", - "decillion" - }; - - for (int i = 0; i < parts.size(); i++) { - int number = std::stoi(parts[i]); - result.push_back(hundreds_to_words(number)); - - if (i > 0 && i < suffixes.size()) { - result.back() += " " + suffixes[i - 1]; +namespace DeepPhonemizer { + std::vector numbers_to_words(const std::string& text) { + std::vector result; + std::vector parts = split_into_threes(text); + std::vector suffixes = { + "thousand", + "million", + "billion", + "trillion", + "quadrillion", + "quintillion", + "sextillion", + "septillion", + "octillion", + "nonillion", + "decillion" + }; + + for (int i = 0; i < parts.size(); i++) { + int number = std::stoi(parts[i]); + result.push_back(hundreds_to_words(number)); + + if (i > 0 && i < suffixes.size()) { + result.back() += " " + suffixes[i - 1]; + } } - } - return result; + return result; + } } \ No newline at end of file diff --git a/src/phonemizer.cpp b/src/phonemizer.cpp index 4968ec8..4ecd2b6 100644 --- a/src/phonemizer.cpp +++ b/src/phonemizer.cpp @@ -4,7 +4,6 @@ #include #include #include -#include "numbers_to_words.hpp" namespace DeepPhonemizer { SequenceTokenizer::SequenceTokenizer(const std::vector& symbols, const std::vector& languages, int char_repeats, bool lowercase, bool append_start_end)