Skip to content

Commit 85de840

Browse files
authored
【Hackathon 8th No.7】Python版本适配 3 (#3969)
* Update setup.py * add optional * fit with praatio>=6.0.0 * Apply suggestions from code review * Apply suggestions from code review * Apply suggestions from code review
1 parent 65dbf46 commit 85de840

File tree

6 files changed

+9
-8
lines changed

6 files changed

+9
-8
lines changed

examples/other/g2p/get_g2p_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def get_baker_data(root_dir):
3232
alignment_fp, includeEmptyIntervals=True)
3333
# only with baker's annotation
3434
utt_id = alignment.tierNameList[0].split(".")[0]
35-
intervals = alignment.tierDict[alignment.tierNameList[0]].entryList
35+
intervals = alignment.getTier(alignment.tierNameList[0]).entries
3636
phones = []
3737
for interval in intervals:
3838
label = interval.label

paddlespeech/server/restful/request.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class TTSRequest(BaseModel):
6565
speed: float = 1.0
6666
volume: float = 1.0
6767
sample_rate: int = 0
68-
save_path: str = None
68+
save_path: Optional[str] = None
6969

7070

7171
#****************************************************************************************/

paddlespeech/server/restful/response.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414
from typing import List
15+
from typing import Optional
1516

1617
from pydantic import BaseModel
1718

@@ -62,7 +63,7 @@ class TTSResult(BaseModel):
6263
volume: float = 1.0
6364
sample_rate: int
6465
duration: float
65-
save_path: str = None
66+
save_path: Optional[str] = None
6667
audio: str
6768

6869

paddlespeech/t2s/exps/ernie_sat/align.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ def _readtg(tg_path: str, lang: str='en', fs: int=24000, n_shift: int=300):
4141
ends = []
4242
words = []
4343

44-
for interval in alignment.tierDict['words'].entryList:
44+
for interval in alignment.getTier('words').entries:
4545
word = interval.label
4646
if word:
4747
words.append(word)
48-
for interval in alignment.tierDict['phones'].entryList:
48+
for interval in alignment.getTier('phones').entries:
4949
phone = interval.label
5050
phones.append(phone)
5151
ends.append(interval.end)

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ def determine_matplotlib_version():
9696
"paddleslim>=2.3.4",
9797
"ppdiffusers>=0.9.0",
9898
"paddlespeech_feat",
99-
"praatio>=5.0.0, <=5.1.1",
99+
"praatio>=6.0.0",
100100
"prettytable",
101-
"pydantic>=1.10.14, <2.0",
101+
"pydantic",
102102
"pypinyin<=0.44.0",
103103
"pypinyin-dict",
104104
"python-dateutil",

utils/gen_duration_from_textgrid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def readtg(tg_path, sample_rate=24000, n_shift=300):
2626
alignment = textgrid.openTextgrid(tg_path, includeEmptyIntervals=True)
2727
phones = []
2828
ends = []
29-
for interval in alignment.tierDict["phones"].entryList:
29+
for interval in alignment.getTier("phones").entries:
3030
phone = interval.label
3131
phones.append(phone)
3232
ends.append(interval.end)

0 commit comments

Comments
 (0)