PyThaiTTS 0.4.2__tar.gz → 0.6.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. {pythaitts-0.4.2 → pythaitts-0.6.0}/PKG-INFO +20 -7
  2. {pythaitts-0.4.2 → pythaitts-0.6.0}/PyThaiTTS.egg-info/PKG-INFO +20 -7
  3. pythaitts-0.6.0/PyThaiTTS.egg-info/SOURCES.txt +37 -0
  4. {pythaitts-0.4.2 → pythaitts-0.6.0}/PyThaiTTS.egg-info/requires.txt +7 -1
  5. {pythaitts-0.4.2 → pythaitts-0.6.0}/README.md +13 -5
  6. {pythaitts-0.4.2 → pythaitts-0.6.0}/pythaitts/__init__.py +25 -12
  7. pythaitts-0.6.0/pythaitts/pretrained/fastthaig2p/__init__.py +35 -0
  8. pythaitts-0.6.0/pythaitts/pretrained/fastthaig2p/_data.py +30 -0
  9. pythaitts-0.6.0/pythaitts/pretrained/fastthaig2p/_th2ipa.py +1576 -0
  10. pythaitts-0.6.0/pythaitts/pretrained/fastthaig2p/data/dict.txt +62112 -0
  11. pythaitts-0.6.0/pythaitts/pretrained/fastthaig2p/data/fallback/PhSTrigram.sts +68702 -0
  12. pythaitts-0.6.0/pythaitts/pretrained/fastthaig2p/data/fallback/sylform_var.pkl +0 -0
  13. pythaitts-0.6.0/pythaitts/pretrained/fastthaig2p/data/fallback/sylrule.lts +273 -0
  14. pythaitts-0.6.0/pythaitts/pretrained/fastthaig2p/data/fallback/sylseg.3g +0 -0
  15. pythaitts-0.6.0/pythaitts/pretrained/fastthaig2p/data/fallback/thaisyl.dict +2127 -0
  16. pythaitts-0.6.0/pythaitts/pretrained/fastthaig2p/data/fallback/thdict +0 -0
  17. pythaitts-0.6.0/pythaitts/pretrained/fastthaig2p/data/ipa.json +62114 -0
  18. pythaitts-0.6.0/pythaitts/pretrained/fastthaig2p/fallback.py +101 -0
  19. pythaitts-0.6.0/pythaitts/pretrained/fastthaig2p/g2p.py +58 -0
  20. pythaitts-0.6.0/pythaitts/pretrained/fastthaig2p/kokoro.py +88 -0
  21. pythaitts-0.6.0/pythaitts/pretrained/fastthaig2p/normalizer.py +502 -0
  22. pythaitts-0.6.0/pythaitts/pretrained/fastthaig2p/tokenizer.py +42 -0
  23. pythaitts-0.6.0/pythaitts/pretrained/fastthaig2p/tts.py +381 -0
  24. {pythaitts-0.4.2 → pythaitts-0.6.0}/pythaitts/pretrained/khanomtan_tts.py +2 -0
  25. {pythaitts-0.4.2 → pythaitts-0.6.0}/setup.py +9 -1
  26. pythaitts-0.6.0/tests/test_fastthaig2p.py +197 -0
  27. {pythaitts-0.4.2 → pythaitts-0.6.0}/tests/test_vachana.py +9 -0
  28. pythaitts-0.4.2/PyThaiTTS.egg-info/SOURCES.txt +0 -19
  29. {pythaitts-0.4.2 → pythaitts-0.6.0}/LICENSE +0 -0
  30. {pythaitts-0.4.2 → pythaitts-0.6.0}/PyThaiTTS.egg-info/dependency_links.txt +0 -0
  31. {pythaitts-0.4.2 → pythaitts-0.6.0}/PyThaiTTS.egg-info/not-zip-safe +0 -0
  32. {pythaitts-0.4.2 → pythaitts-0.6.0}/PyThaiTTS.egg-info/top_level.txt +0 -0
  33. {pythaitts-0.4.2 → pythaitts-0.6.0}/pythaitts/preprocess.py +0 -0
  34. {pythaitts-0.4.2 → pythaitts-0.6.0}/pythaitts/pretrained/__init__.py +0 -0
  35. {pythaitts-0.4.2 → pythaitts-0.6.0}/pythaitts/pretrained/lunarlist_model.py +0 -0
  36. {pythaitts-0.4.2 → pythaitts-0.6.0}/pythaitts/pretrained/lunarlist_onnx.py +0 -0
  37. {pythaitts-0.4.2 → pythaitts-0.6.0}/pythaitts/pretrained/vachana_tts.py +0 -0
  38. {pythaitts-0.4.2 → pythaitts-0.6.0}/setup.cfg +0 -0
  39. {pythaitts-0.4.2 → pythaitts-0.6.0}/tests/__init__.py +0 -0
  40. {pythaitts-0.4.2 → pythaitts-0.6.0}/tests/test_preprocess.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyThaiTTS
3
- Version: 0.4.2
3
+ Version: 0.6.0
4
4
  Summary: Open Source Thai Text-to-speech library in Python
5
5
  Home-page: https://github.com/pythainlp/pythaitts
6
6
  Author: Wannaphong
@@ -24,8 +24,12 @@ License-File: LICENSE
24
24
  Requires-Dist: huggingface_hub
25
25
  Requires-Dist: numpy>=1.22
26
26
  Requires-Dist: onnxruntime
27
- Requires-Dist: vachanatts
28
27
  Requires-Dist: soundfile
28
+ Requires-Dist: pythainlp
29
+ Provides-Extra: vachanatts
30
+ Requires-Dist: vachanatts; extra == "vachanatts"
31
+ Provides-Extra: vachana
32
+ Requires-Dist: vachanatts; extra == "vachana"
29
33
  Dynamic: author
30
34
  Dynamic: author-email
31
35
  Dynamic: classifier
@@ -36,6 +40,7 @@ Dynamic: keywords
36
40
  Dynamic: license
37
41
  Dynamic: license-file
38
42
  Dynamic: project-url
43
+ Dynamic: provides-extra
39
44
  Dynamic: requires-dist
40
45
  Dynamic: requires-python
41
46
  Dynamic: summary
@@ -43,7 +48,7 @@ Dynamic: summary
43
48
  # PyThaiTTS
44
49
  Open Source Thai Text-to-speech library in Python
45
50
 
46
- [Google Colab](https://colab.research.google.com/github/PyThaiNLP/PyThaiTTS/blob/dev/notebook/use_lunarlist_model.ipynb) | [Docs](https://pythainlp.github.io/PyThaiTTS/) | [Notebooks](https://github.com/PyThaiNLP/PyThaiTTS/tree/dev/notebook)
51
+ [Google Colab](https://colab.research.google.com/github/PyThaiNLP/PyThaiTTS/blob/main/notebook/use_fastthaig2p.ipynb) | [Docs](https://pythainlp.github.io/PyThaiTTS/) | [Notebooks](https://github.com/PyThaiNLP/PyThaiTTS/tree/main/notebook)
47
52
  <a href="https://pepy.tech/project/pythaitts"><img alt="Download" src="https://pepy.tech/badge/pythaitts/month"/></a>
48
53
 
49
54
  License: [Apache-2.0 License](https://github.com/PyThaiNLP/pythaitts/blob/main/LICENSE)
@@ -75,15 +80,23 @@ PyThaiTTS supports multiple TTS models. You can specify which model to use:
75
80
  ```python
76
81
  from pythaitts import TTS
77
82
 
78
- # Use VachanaTTS (default voices: th_f_1, th_m_1, th_f_2, th_m_2)
79
- tts = TTS(pretrained="vachana")
80
- file = tts.tts("สวัสดีครับ", speaker_idx="th_f_1", filename="output.wav")
83
+ # Use FastThaiG2P (default) (default voice: thai_som)
84
+ # FastThaiG2P Sample Rate is 24000 Hz
85
+ tts = TTS(pretrained="fastthaig2p")
86
+ file = tts.tts("สวัสดีครับ", speaker_idx="thai_som", filename="output.wav")
81
87
 
82
- # Use Lunarlist ONNX (default)
88
+ # Use Lunarlist ONNX
89
+ # Sample Rate is 22050 Hz
83
90
  tts = TTS(pretrained="lunarlist_onnx")
84
91
  file = tts.tts("ภาษาไทย ง่าย มาก", filename="output.wav")
85
92
 
93
+ # Use VachanaTTS (default voices: th_f_1, th_m_1, th_f_2, th_m_2)
94
+ # Sample Rate is 22050 Hz
95
+ tts = TTS(pretrained="vachana")
96
+ file = tts.tts("สวัสดีครับ", speaker_idx="th_f_1", filename="output.wav")
97
+
86
98
  # Use KhanomTan
99
+ # Sample Rate is 16000 Hz
87
100
  tts = TTS(pretrained="khanomtan")
88
101
  file = tts.tts("ภาษาไทย", speaker_idx="Linda", filename="output.wav")
89
102
  ```
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyThaiTTS
3
- Version: 0.4.2
3
+ Version: 0.6.0
4
4
  Summary: Open Source Thai Text-to-speech library in Python
5
5
  Home-page: https://github.com/pythainlp/pythaitts
6
6
  Author: Wannaphong
@@ -24,8 +24,12 @@ License-File: LICENSE
24
24
  Requires-Dist: huggingface_hub
25
25
  Requires-Dist: numpy>=1.22
26
26
  Requires-Dist: onnxruntime
27
- Requires-Dist: vachanatts
28
27
  Requires-Dist: soundfile
28
+ Requires-Dist: pythainlp
29
+ Provides-Extra: vachanatts
30
+ Requires-Dist: vachanatts; extra == "vachanatts"
31
+ Provides-Extra: vachana
32
+ Requires-Dist: vachanatts; extra == "vachana"
29
33
  Dynamic: author
30
34
  Dynamic: author-email
31
35
  Dynamic: classifier
@@ -36,6 +40,7 @@ Dynamic: keywords
36
40
  Dynamic: license
37
41
  Dynamic: license-file
38
42
  Dynamic: project-url
43
+ Dynamic: provides-extra
39
44
  Dynamic: requires-dist
40
45
  Dynamic: requires-python
41
46
  Dynamic: summary
@@ -43,7 +48,7 @@ Dynamic: summary
43
48
  # PyThaiTTS
44
49
  Open Source Thai Text-to-speech library in Python
45
50
 
46
- [Google Colab](https://colab.research.google.com/github/PyThaiNLP/PyThaiTTS/blob/dev/notebook/use_lunarlist_model.ipynb) | [Docs](https://pythainlp.github.io/PyThaiTTS/) | [Notebooks](https://github.com/PyThaiNLP/PyThaiTTS/tree/dev/notebook)
51
+ [Google Colab](https://colab.research.google.com/github/PyThaiNLP/PyThaiTTS/blob/main/notebook/use_fastthaig2p.ipynb) | [Docs](https://pythainlp.github.io/PyThaiTTS/) | [Notebooks](https://github.com/PyThaiNLP/PyThaiTTS/tree/main/notebook)
47
52
  <a href="https://pepy.tech/project/pythaitts"><img alt="Download" src="https://pepy.tech/badge/pythaitts/month"/></a>
48
53
 
49
54
  License: [Apache-2.0 License](https://github.com/PyThaiNLP/pythaitts/blob/main/LICENSE)
@@ -75,15 +80,23 @@ PyThaiTTS supports multiple TTS models. You can specify which model to use:
75
80
  ```python
76
81
  from pythaitts import TTS
77
82
 
78
- # Use VachanaTTS (default voices: th_f_1, th_m_1, th_f_2, th_m_2)
79
- tts = TTS(pretrained="vachana")
80
- file = tts.tts("สวัสดีครับ", speaker_idx="th_f_1", filename="output.wav")
83
+ # Use FastThaiG2P (default) (default voice: thai_som)
84
+ # FastThaiG2P Sample Rate is 24000 Hz
85
+ tts = TTS(pretrained="fastthaig2p")
86
+ file = tts.tts("สวัสดีครับ", speaker_idx="thai_som", filename="output.wav")
81
87
 
82
- # Use Lunarlist ONNX (default)
88
+ # Use Lunarlist ONNX
89
+ # Sample Rate is 22050 Hz
83
90
  tts = TTS(pretrained="lunarlist_onnx")
84
91
  file = tts.tts("ภาษาไทย ง่าย มาก", filename="output.wav")
85
92
 
93
+ # Use VachanaTTS (default voices: th_f_1, th_m_1, th_f_2, th_m_2)
94
+ # Sample Rate is 22050 Hz
95
+ tts = TTS(pretrained="vachana")
96
+ file = tts.tts("สวัสดีครับ", speaker_idx="th_f_1", filename="output.wav")
97
+
86
98
  # Use KhanomTan
99
+ # Sample Rate is 16000 Hz
87
100
  tts = TTS(pretrained="khanomtan")
88
101
  file = tts.tts("ภาษาไทย", speaker_idx="Linda", filename="output.wav")
89
102
  ```
@@ -0,0 +1,37 @@
1
+ LICENSE
2
+ README.md
3
+ setup.py
4
+ PyThaiTTS.egg-info/PKG-INFO
5
+ PyThaiTTS.egg-info/SOURCES.txt
6
+ PyThaiTTS.egg-info/dependency_links.txt
7
+ PyThaiTTS.egg-info/not-zip-safe
8
+ PyThaiTTS.egg-info/requires.txt
9
+ PyThaiTTS.egg-info/top_level.txt
10
+ pythaitts/__init__.py
11
+ pythaitts/preprocess.py
12
+ pythaitts/pretrained/__init__.py
13
+ pythaitts/pretrained/khanomtan_tts.py
14
+ pythaitts/pretrained/lunarlist_model.py
15
+ pythaitts/pretrained/lunarlist_onnx.py
16
+ pythaitts/pretrained/vachana_tts.py
17
+ pythaitts/pretrained/fastthaig2p/__init__.py
18
+ pythaitts/pretrained/fastthaig2p/_data.py
19
+ pythaitts/pretrained/fastthaig2p/_th2ipa.py
20
+ pythaitts/pretrained/fastthaig2p/fallback.py
21
+ pythaitts/pretrained/fastthaig2p/g2p.py
22
+ pythaitts/pretrained/fastthaig2p/kokoro.py
23
+ pythaitts/pretrained/fastthaig2p/normalizer.py
24
+ pythaitts/pretrained/fastthaig2p/tokenizer.py
25
+ pythaitts/pretrained/fastthaig2p/tts.py
26
+ pythaitts/pretrained/fastthaig2p/data/dict.txt
27
+ pythaitts/pretrained/fastthaig2p/data/ipa.json
28
+ pythaitts/pretrained/fastthaig2p/data/fallback/PhSTrigram.sts
29
+ pythaitts/pretrained/fastthaig2p/data/fallback/sylform_var.pkl
30
+ pythaitts/pretrained/fastthaig2p/data/fallback/sylrule.lts
31
+ pythaitts/pretrained/fastthaig2p/data/fallback/sylseg.3g
32
+ pythaitts/pretrained/fastthaig2p/data/fallback/thaisyl.dict
33
+ pythaitts/pretrained/fastthaig2p/data/fallback/thdict
34
+ tests/__init__.py
35
+ tests/test_fastthaig2p.py
36
+ tests/test_preprocess.py
37
+ tests/test_vachana.py
@@ -1,5 +1,11 @@
1
1
  huggingface_hub
2
2
  numpy>=1.22
3
3
  onnxruntime
4
- vachanatts
5
4
  soundfile
5
+ pythainlp
6
+
7
+ [vachana]
8
+ vachanatts
9
+
10
+ [vachanatts]
11
+ vachanatts
@@ -1,7 +1,7 @@
1
1
  # PyThaiTTS
2
2
  Open Source Thai Text-to-speech library in Python
3
3
 
4
- [Google Colab](https://colab.research.google.com/github/PyThaiNLP/PyThaiTTS/blob/dev/notebook/use_lunarlist_model.ipynb) | [Docs](https://pythainlp.github.io/PyThaiTTS/) | [Notebooks](https://github.com/PyThaiNLP/PyThaiTTS/tree/dev/notebook)
4
+ [Google Colab](https://colab.research.google.com/github/PyThaiNLP/PyThaiTTS/blob/main/notebook/use_fastthaig2p.ipynb) | [Docs](https://pythainlp.github.io/PyThaiTTS/) | [Notebooks](https://github.com/PyThaiNLP/PyThaiTTS/tree/main/notebook)
5
5
  <a href="https://pepy.tech/project/pythaitts"><img alt="Download" src="https://pepy.tech/badge/pythaitts/month"/></a>
6
6
 
7
7
  License: [Apache-2.0 License](https://github.com/PyThaiNLP/pythaitts/blob/main/LICENSE)
@@ -33,15 +33,23 @@ PyThaiTTS supports multiple TTS models. You can specify which model to use:
33
33
  ```python
34
34
  from pythaitts import TTS
35
35
 
36
- # Use VachanaTTS (default voices: th_f_1, th_m_1, th_f_2, th_m_2)
37
- tts = TTS(pretrained="vachana")
38
- file = tts.tts("สวัสดีครับ", speaker_idx="th_f_1", filename="output.wav")
36
+ # Use FastThaiG2P (default) (default voice: thai_som)
37
+ # FastThaiG2P Sample Rate is 24000 Hz
38
+ tts = TTS(pretrained="fastthaig2p")
39
+ file = tts.tts("สวัสดีครับ", speaker_idx="thai_som", filename="output.wav")
39
40
 
40
- # Use Lunarlist ONNX (default)
41
+ # Use Lunarlist ONNX
42
+ # Sample Rate is 22050 Hz
41
43
  tts = TTS(pretrained="lunarlist_onnx")
42
44
  file = tts.tts("ภาษาไทย ง่าย มาก", filename="output.wav")
43
45
 
46
+ # Use VachanaTTS (default voices: th_f_1, th_m_1, th_f_2, th_m_2)
47
+ # Sample Rate is 22050 Hz
48
+ tts = TTS(pretrained="vachana")
49
+ file = tts.tts("สวัสดีครับ", speaker_idx="th_f_1", filename="output.wav")
50
+
44
51
  # Use KhanomTan
52
+ # Sample Rate is 16000 Hz
45
53
  tts = TTS(pretrained="khanomtan")
46
54
  file = tts.tts("ภาษาไทย", speaker_idx="Linda", filename="output.wav")
47
55
  ```
@@ -2,18 +2,18 @@
2
2
  """
3
3
  PyThaiTTS
4
4
  """
5
- __version__ = "0.4.2"
5
+ __version__ = "0.6.0"
6
6
 
7
7
  from pythaitts.preprocess import preprocess_text, num_to_thai, expand_maiyamok
8
8
 
9
9
 
10
10
  class TTS:
11
- def __init__(self, pretrained="lunarlist_onnx", mode="last_checkpoint", version="1.0", device:str="cpu") -> None:
11
+ def __init__(self, pretrained="fastthaig2p", mode="last_checkpoint", version="1.0", device:str="cpu", **kwargs) -> None:
12
12
  """
13
- :param str pretrained: TTS pretrained (lunarlist_onnx, khanomtan, lunarlist, vachana)
14
- :param str mode: pretrained mode (lunarlist_onnx and vachana don't support)
13
+ :param str pretrained: TTS pretrained (fastthaig2p, lunarlist_onnx, khanomtan, lunarlist, vachana)
14
+ :param str mode: pretrained mode (fastthaig2p, lunarlist_onnx, and vachana don't support)
15
15
  :param str version: model version (default is 1.0 or 1.1)
16
- :param str device: device for running model. (lunarlist_onnx and vachana support CPU only.)
16
+ :param str device: device for running model. (fastthaig2p, lunarlist_onnx, and vachana support CPU only.)
17
17
 
18
18
  **Options for mode**
19
19
  * *last_checkpoint* (default) - last checkpoint of model
@@ -29,17 +29,18 @@ class TTS:
29
29
  For lunarlist_onnx tts model, \
30
30
  You can see more about lunarlist tts at `https://github.com/PyThaiNLP/thaitts-onnx <https://github.com/PyThaiNLP/thaitts-onnx>`_
31
31
 
32
- For vachana tts model, \
32
+ For vachana tts model, you must install vachanatts before using the model by pip install vachanatts.
33
33
  You can see more about vachana tts at `https://github.com/VYNCX/VachanaTTS2 <https://github.com/VYNCX/VachanaTTS2>`_
34
34
 
35
-
35
+ For fastthaig2p tts model, \
36
+ You can see more about fastthaig2p at `https://github.com/awslabs/FastThaiG2P <https://github.com/awslabs/FastThaiG2P>`_
36
37
  """
37
38
  self.pretrained = pretrained
38
39
  self.mode = mode
39
40
  self.device = device
40
- self.load_pretrained(version=version)
41
+ self.load_pretrained(version=version, **kwargs)
41
42
 
42
- def load_pretrained(self,version):
43
+ def load_pretrained(self, version="1.0", **kwargs):
43
44
  """
44
45
  Load pretrained
45
46
  """
@@ -55,21 +56,25 @@ class TTS:
55
56
  elif self.pretrained == "vachana":
56
57
  from pythaitts.pretrained.vachana_tts import VachanaTTS
57
58
  self.model = VachanaTTS()
59
+ elif self.pretrained in ("fastthaig2p", "FastThaiG2P"):
60
+ from pythaitts.pretrained.fastthaig2p import FastThaiG2P
61
+ self.model = FastThaiG2P(device=self.device, **kwargs)
58
62
  else:
59
63
  raise NotImplementedError(
60
64
  "PyThaiTTS doesn't support %s pretrained." % self.pretrained
61
65
  )
62
66
 
63
- def tts(self, text: str, speaker_idx: str = "Linda", language_idx: str = "th-th", return_type: str = "file", filename: str = None, preprocess: bool = True):
67
+ def tts(self, text: str, speaker_idx: str = "thai_som", language_idx: str = "th-th", return_type: str = "file", filename: str = None, preprocess: bool = True, **kwargs):
64
68
  """
65
69
  speech synthesis
66
70
 
67
71
  :param str text: text
68
- :param str speaker_idx: speaker (default is Linda for khanomtan, th_f_1 for vachana)
72
+ :param str speaker_idx: speaker (default is thai_som for fastthaig2p, Linda for khanomtan, th_f_1 for vachana)
69
73
  :param str language_idx: language (default is th-th)
70
74
  :param str return_type: return type (default is file)
71
75
  :param str filename: path filename for save wav file if return_type is file.
72
76
  :param bool preprocess: whether to preprocess text (convert numbers to Thai text and expand ๆ). Default is True.
77
+ :param kwargs: Additional parameters passed to the underlying model.
73
78
  """
74
79
  # Preprocess text if requested
75
80
  if preprocess:
@@ -79,7 +84,15 @@ class TTS:
79
84
  if self.pretrained == "lunarlist" or self.pretrained == "lunarlist_onnx":
80
85
  return self.model(text=text,return_type=return_type,filename=filename)
81
86
  elif self.pretrained == "vachana":
82
- return self.model(text=text,speaker_idx=speaker_idx,return_type=return_type,filename=filename)
87
+ if speaker_idx in ("thai_som", "Linda", None):
88
+ speaker_idx = "th_f_1"
89
+ return self.model(text=text,speaker_idx=speaker_idx,return_type=return_type,filename=filename, **kwargs)
90
+ elif self.pretrained in ("fastthaig2p", "FastThaiG2P"):
91
+ if speaker_idx in ("Linda", None):
92
+ speaker_idx = "thai_som"
93
+ return self.model(text=text,speaker_idx=speaker_idx,return_type=return_type,filename=filename, **kwargs)
94
+ if speaker_idx in ("thai_som", None):
95
+ speaker_idx = "Linda"
83
96
  return self.model(
84
97
  text=text,
85
98
  speaker_idx=speaker_idx,
@@ -0,0 +1,35 @@
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ ## License
4
+
5
+ Copyright 2026 Charin Polpanumas and Amazon Web Services
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
18
+ """
19
+ from __future__ import annotations
20
+
21
+ from .g2p import G2P
22
+ from .kokoro import ipa_to_kokoro
23
+ from .normalizer import normalize
24
+ from .tokenizer import Tokenizer
25
+
26
+ __all__ = ["G2P", "Tokenizer", "normalize", "ipa_to_kokoro", "TTS", "FastThaiG2P"]
27
+
28
+
29
+ def __getattr__(name):
30
+ if name in ("TTS", "FastThaiG2P"):
31
+ from .tts import TTS, FastThaiG2P
32
+
33
+ return FastThaiG2P if name == "FastThaiG2P" else TTS
34
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
35
+
@@ -0,0 +1,30 @@
1
+ """Locate runtime data in both layouts: installed wheel (fastthaig2p/data,
2
+ via the force-include in pyproject.toml) and repo checkout (../data).
3
+
4
+ ## License
5
+
6
+ Copyright 2026 Charin Polpanumas and Amazon Web Services
7
+
8
+ Licensed under the Apache License, Version 2.0 (the "License");
9
+ you may not use this file except in compliance with the License.
10
+ You may obtain a copy of the License at
11
+
12
+ http://www.apache.org/licenses/LICENSE-2.0
13
+
14
+ Unless required by applicable law or agreed to in writing, software
15
+ distributed under the License is distributed on an "AS IS" BASIS,
16
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ See the License for the specific language governing permissions and
18
+ limitations under the License.
19
+ """
20
+
21
+ from pathlib import Path
22
+
23
+ _PKG = Path(__file__).parent
24
+
25
+
26
+ def data_path(*parts: str) -> Path:
27
+ installed = _PKG / "data" / Path(*parts)
28
+ if installed.exists():
29
+ return installed
30
+ return _PKG.parent / "data" / Path(*parts)