Commit 509b53ab by ‘chizw’

[+]脚本更新

1 parent 4f6d32a9
...@@ -98,11 +98,11 @@ class FunasrService(object): ...@@ -98,11 +98,11 @@ class FunasrService(object):
batch_size_s=300, batch_size_s=300,
batch_size_threshold_s=60, batch_size_threshold_s=60,
hotword="问界 100\n质保经理 100\n易损易耗件 100\n电瓶 100\nM5 100\nM7 100\nM9 100\n石子 100" hotword="问界 100\n质保经理 100\n易损易耗件 100\n电瓶 100\nM5 100\nM7 100\nM9 100\n石子 100"
"\n橡胶棒 100\n电子助力泵 100\n电子真空助力泵 100\n充电桩 100\n密封圈 100\n4S店 100\n老化 100" "橡胶棒 100\n电子助力泵 100\n电子真空助力泵 100\n充电桩 100\n密封圈 100\n4S店 100\n老化 100"
"\n打死 100\n油车 100\n电车 100\n备忘录 100\n自费 100\n胶套求成密封圈 100\n安信无忧 100" "打死 100\n油车 100\n电车 100\n备忘录 100\n自费 100\n胶套求成密封圈 100\n安信无忧 100"
"\n全车易损耗件 100\n厂家 100\n喷漆 100\n封釉 100\n雾化 100\n里程 100\n延保 100\n外地牌 100" "全车易损耗件 100\n厂家 100\n喷漆 100\n封釉 100\n雾化 100\n里程 100\n延保 100\n外地牌 100"
"\n轮胎 100\n胶条 100\n漆面 100\n充电接口 100\n车衣 100\n传动车身 100\n喜提新车 100" "轮胎 100\n胶条 100\n漆面 100\n充电接口 100\n车衣 100\n传动车身 100\n喜提新车 100"
"\n估计 100\n安心包 100\n定损金额 100") "估计 100\n安心包 100\n定损金额 100")
# print(res) # print(res)
return res return res
......
...@@ -182,16 +182,27 @@ credentials = AccessKeyCredential(os.environ['ALIBABA_CLOUD_ACCESS_KEY_ID'], ...@@ -182,16 +182,27 @@ credentials = AccessKeyCredential(os.environ['ALIBABA_CLOUD_ACCESS_KEY_ID'],
client = AcsClient(region_id='cn-beijing', credential=credentials) client = AcsClient(region_id='cn-beijing', credential=credentials)
# fileUrl = 'https://glsk-oss.oss-cn-shenzhen.aliyuncs.com/quality/d15515d1-6ccb-4e58-9ebf-47d45677b298.mp3' # fileUrl = 'https://glsk-oss.oss-cn-shenzhen.aliyuncs.com/quality/d15515d1-6ccb-4e58-9ebf-47d45677b298.mp3'
base_path = "D:/software/python/project/funasr_web/audios/830/" base_path = "D:/software/python/project/funasr_web/audios/0903/"
txt_path = "D:/software/python/project/funasr_web/audios/11111.txt" txt_path = "D:/software/python/project/funasr_web/audios/11111.txt"
with open(txt_path, 'r', encoding='utf-8') as file:
for index, line in enumerate(file, 1): def run_file():
print(f"line==={line}") with open(txt_path, 'r', encoding='utf-8') as file:
parts = line.strip().split(',') for index, line in enumerate(file, 1):
name = parts[0] print(f"line==={line}")
fileUrl = parts[1] parts = line.strip().split(',')
taskId = submitTask(fileUrl) name = parts[0]
# taskId = 'd80649120bc04d10892f99d70082c194' fileUrl = parts[1]
print('taskId:' + taskId) taskId = submitTask(fileUrl)
text_list = dealTaskResult(taskId) # taskId = 'd80649120bc04d10892f99d70082c194'
write_file(text_list, f"{base_path}{name}.txt") print('taskId:' + taskId)
text_list = dealTaskResult(taskId)
write_file(text_list, f"{base_path}{name}.txt")
def run_simple(fileUrl, name=None):
taskId = submitTask(fileUrl)
# taskId = 'd80649120bc04d10892f99d70082c194'
print('taskId:' + taskId)
text_list = dealTaskResult(taskId)
write_file(text_list, f"{base_path}{name}.txt")
run_simple("https://glsk-oss.oss-cn-shenzhen.aliyuncs.com/quality/1715688494984merged_17153238831671715320257955.mp3",name="test")
\ No newline at end of file \ No newline at end of file
import difflib import difflib
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
def compare_texts(file1_path, file2_path, output_file_path): def compare_texts(file1_path, file2_path, output_file_path, fromdesc='Text 1', todesc='Text 2'):
print('================================start...===============================') print('================================start...===============================')
# 从文件中读取文本内容 # 从文件中读取文本内容
with open(file1_path, 'r', encoding='utf-8') as file1: with open(file1_path, 'r', encoding='utf-8') as file1:
...@@ -15,7 +15,7 @@ def compare_texts(file1_path, file2_path, output_file_path): ...@@ -15,7 +15,7 @@ def compare_texts(file1_path, file2_path, output_file_path):
# 创建HtmlDiff对象来生成HTML格式的差异报告 # 创建HtmlDiff对象来生成HTML格式的差异报告
d = difflib.HtmlDiff() d = difflib.HtmlDiff()
diff_html = d.make_file(text1.splitlines(), text2.splitlines(), fromdesc='Text 1', todesc='Text 2') diff_html = d.make_file(text1.splitlines(), text2.splitlines(), fromdesc=fromdesc, todesc=todesc)
# 使用BeautifulSoup解析HTML报告 # 使用BeautifulSoup解析HTML报告
soup = BeautifulSoup(diff_html, 'html.parser') soup = BeautifulSoup(diff_html, 'html.parser')
...@@ -77,7 +77,13 @@ filename = '82874' ...@@ -77,7 +77,13 @@ filename = '82874'
# output_file_path = f'voicetranseform/compareresult/asresult/{filename}/diff_output_v1.0.6.html' # output_file_path = f'voicetranseform/compareresult/asresult/{filename}/diff_output_v1.0.6.html'
# compare_texts(file1_path, file2_path, output_file_path) # compare_texts(file1_path, file2_path, output_file_path)
file1_path = f'C:/Users/chizw/Desktop/新建文本文档.txt' file1_path = f'D:/software/python/project/funasr_web/audios/leven/correct.txt'
file2_path = f'C:/Users/chizw/Desktop/output.txt' file2_path = f'D:/software/python/project/funasr_web/audios/leven/origin.txt'
output_file_path = f'C:/Users/chizw/Desktop/diff_output_v1.0.6.source.html' file3_path = f'D:/software/python/project/funasr_web/audios/leven/output1.txt'
compare_texts(file1_path, file2_path, output_file_path) file4_path = f'D:/software/python/project/funasr_web/audios/leven/output2.txt'
file5_path = f'D:/software/python/project/funasr_web/audios/leven/output3.txt'
output_file_path = f'D:/software/python/project/funasr_web/audios/leven/diff_output_v1.0.6.source.html'
compare_texts(file1_path, file2_path, f'D:/software/python/project/funasr_web/audios/leven/diff/origin.html', fromdesc='标注答案', todesc='初次推理')
compare_texts(file1_path, file3_path, f'D:/software/python/project/funasr_web/audios/leven/diff/output1.html', fromdesc='标注答案', todesc='第一次训练后')
compare_texts(file1_path, file4_path, f'D:/software/python/project/funasr_web/audios/leven/diff/output2.html', fromdesc='标注答案', todesc='第二次训练后')
compare_texts(file1_path, file5_path, f'D:/software/python/project/funasr_web/audios/leven/diff/output3.html', fromdesc='标注答案', todesc='第三次训练后')
...@@ -173,4 +173,10 @@ list = [866,-430,867,870,871,872,873] ...@@ -173,4 +173,10 @@ list = [866,-430,867,870,871,872,873]
for id in list: for id in list:
# voice_slicing(id) # voice_slicing(id)
pass
\ No newline at end of file \ No newline at end of file
pass
with open("D:/software/python/project/funasr_web/dataset/temp/train/train_text.txt", 'r', encoding='gbk') as file:
for index, line in enumerate(file, 1):
parts = line.split(' ')
name = parts[0]
upload_file(f"{index}.wav",f"D:/software/python/project/funasr_web/dataset/temp/0830_{name}.wav")
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!