CoolFace
Apppublic

ASLP-lab/DiffRhythm

sourceHugging Faceapache-2.0updated 1y agoView on Hugging Face
689likes
front_utils.py21 linesDownload Raw Back to utils
1# Copyright (c) 2024 Amphion.2#3# This source code is licensed under the MIT license found in the4# LICENSE file in the root directory of this source tree.5 6import os7 8 9def generate_poly_lexicon(file_path: str):10    """Generate poly char lexicon for Mandarin Chinese."""11    poly_dict = {}12 13    with open(file_path, "r", encoding="utf-8") as readf:14        txt_list = readf.readlines()15        for txt in txt_list:16            word = txt.strip("\n")17            if word not in poly_dict:18                poly_dict[word] = 119        readf.close()20    return poly_dict21