diff --git a/paddlespeech/t2s/assets/sentences_mix.txt b/paddlespeech/t2s/assets/sentences_mix.txt index 06e97d14a..bfa0db636 100644 --- a/paddlespeech/t2s/assets/sentences_mix.txt +++ b/paddlespeech/t2s/assets/sentences_mix.txt @@ -5,4 +5,5 @@ 005 Paddle Bo Bo: 使用 Paddle Speech 的语音合成模块生成虚拟人的声音。 006 热烈欢迎您在 Discussions 中提交问题,并在 Issues 中指出发现的 bug。此外,我们非常希望您参与到 Paddle Speech 的开发中! 007 我喜欢 eat apple, 你喜欢 drink milk。 -008 我们要去云南 team building, 非常非常 happy. \ No newline at end of file +008 我们要去云南 team building, 非常非常 happy. +009 AI for Sceience 平台。 \ No newline at end of file diff --git a/paddlespeech/t2s/frontend/phonectic.py b/paddlespeech/t2s/frontend/phonectic.py index b3f64dc52..d6c66f1e0 100644 --- a/paddlespeech/t2s/frontend/phonectic.py +++ b/paddlespeech/t2s/frontend/phonectic.py @@ -47,10 +47,29 @@ class Phonetics(ABC): class English(Phonetics): """ Normalize the input text sequence and convert into pronunciation id sequence. + + https://github.com/Kyubyong/g2p/blob/master/g2p_en/g2p.py + + phonemes = ["", "", "", ""] + [ + 'AA0', 'AA1', 'AA2', 'AE0', 'AE1', 'AE2', 'AH0', 'AH1', 'AH2', 'AO0', + 'AO1', 'AO2', 'AW0', 'AW1', 'AW2', 'AY0', 'AY1', 'AY2', 'B', 'CH', 'D', 'DH', + 'EH0', 'EH1', 'EH2', 'ER0', 'ER1', 'ER2', 'EY0', 'EY1', + 'EY2', 'F', 'G', 'HH', + 'IH0', 'IH1', 'IH2', 'IY0', 'IY1', 'IY2', 'JH', 'K', 'L', + 'M', 'N', 'NG', 'OW0', 'OW1', + 'OW2', 'OY0', 'OY1', 'OY2', 'P', 'R', 'S', 'SH', 'T', 'TH', + 'UH0', 'UH1', 'UH2', 'UW', + 'UW0', 'UW1', 'UW2', 'V', 'W', 'Y', 'Z', 'ZH'] """ + LEXICON = { + # key using lowercase + "AI".lower(): [["EY0", "AY1"]], + } + def __init__(self, phone_vocab_path=None): self.backend = G2p() + self.backend.cmu.update(English.LEXICON) self.phonemes = list(self.backend.phonemes) self.punctuations = get_punctuations("en") self.vocab = Vocab(self.phonemes + self.punctuations) diff --git a/tests/unit/tts/test_mixfrontend.py b/tests/unit/tts/test_mixfrontend.py index 24167338f..5751dd2a7 100644 --- a/tests/unit/tts/test_mixfrontend.py +++ b/tests/unit/tts/test_mixfrontend.py @@ -1,3 +1,16 @@ +# Copyright (c) 2023 PaddlePaddle Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import re import tempfile diff --git a/tests/unit/tts/test_ssml.py b/tests/unit/tts/test_ssml.py index 382558a4f..2c2401837 100644 --- a/tests/unit/tts/test_ssml.py +++ b/tests/unit/tts/test_ssml.py @@ -1,3 +1,16 @@ +# Copyright (c) 2023 PaddlePaddle Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. from paddlespeech.t2s.frontend.ssml.xml_processor import MixTextProcessor if __name__ == '__main__':