Download Vinorm/vinorm/__init__.py from duyv/API_MC_AI: direct link, hf CLI and curl.
- Browser
- Download file 878 Bytes
-
https://huggingface.co/duyv/API_MC_AI/resolve/main/Vinorm/vinorm/__init__.py
- Command line
-
hf download hf://duyv/API_MC_AI/Vinorm/vinorm/__init__.py
-
curl -L -o __init__.py https://huggingface.co/duyv/API_MC_AI/resolve/main/Vinorm/vinorm/__init__.py
878 Bytes
| import subprocess,os | |
| import imp | |
| def TTSnorm(text, punc = False, unknown = True, lower = True, rule = False ): | |
| A=imp.find_module('vinorm')[1] | |
| #print(A) | |
| I=A+"/input.txt" | |
| with open(I, mode="w+", encoding="utf-8") as fw: | |
| fw.write(text) | |
| myenv = os.environ.copy() | |
| myenv['LD_LIBRARY_PATH'] = A+'/lib' | |
| E=A+"/main" | |
| Command = [E] | |
| if punc: | |
| Command.append("-punc") | |
| if unknown: | |
| Command.append("-unknown") | |
| if lower: | |
| Command.append("-lower") | |
| if rule: | |
| Command.append("-rule") | |
| subprocess.check_call(Command, env=myenv, cwd=A) | |
| O=A+"/output.txt" | |
| with open(O, mode="r", encoding="utf-8") as fr: | |
| text=fr.read() | |
| TEXT="" | |
| S=text.split("#line#") | |
| for s in S: | |
| if s=="": | |
| continue | |
| TEXT+=s+". " | |
| return TEXT | |