nl8590687 / ASRT_SpeechRecognition

A Deep-Learning-Based Chinese Speech Recognition System 基于深度学习的中文语音识别系统
https://asrt.ailemon.net
GNU General Public License v3.0
7.85k stars 1.9k forks source link

No such file or directory: './/dict.txt' #185

Open TLHorse opened 4 years ago

TLHorse commented 4 years ago

如题,运行test.py后,会出现错误:

Traceback (most recent call last):
  File "/Users/MaTianlai/Downloads/ASRT_v0.6.1/test.py", line 35, in <module>
    r = ms.RecognizeSpeech_FromFile('/Users/MaTianlai/Downloads/ASRT_v0.6.1/resources/test.wav')
  File "/Users/MaTianlai/Downloads/ASRT_v0.6.1/SpeechModel251.py", line 380, in RecognizeSpeech_FromFile
    r = self.RecognizeSpeech(wavsignal, fs)
  File "/Users/MaTianlai/Downloads/ASRT_v0.6.1/SpeechModel251.py", line 365, in RecognizeSpeech
    list_symbol_dic = GetSymbolList(self.datapath) # 获取拼音列表
  File "/Users/MaTianlai/Downloads/ASRT_v0.6.1/general_function/file_dict.py", line 17, in GetSymbolList
    txt_obj=open(datapath + 'dict.txt','r',encoding='UTF-8') # 打开文件并读入
FileNotFoundError: [Errno 2] No such file or directory: './/dict.txt'

我在test.py里这样设置:

datapath = "./"
modelpath = 'model_speech'

system_type = plat.system() # 由于不同的系统的文件路径表示不一样,需要进行判断
if system_type == 'Windows':
    datapath = '.'
    modelpath = modelpath + '\\'
elif system_type == 'Linux':
    datapath = '.'
    modelpath = modelpath + '/'
else:
    print('*[Message] Unknown System\n')
    datapath = '.'
    modelpath = modelpath + ''

不管datapath怎样设置,到最后dict.txt的路径总是会多一条斜杠:.//dict.py。 我看了#179,但是还是不知道改怎样强制更改路径。求助。

另外我不知道为什么platform模块识别我的macOS,识别出来的是Darwin

nl8590687 commented 4 years ago

可能是因为你是在mac系统上运行的,一些文件路径和我这里的windows系统和linux系统下不一样,请尽量用linux系统或者windows系统运行,因为我没有mac,一些bug问题无法调试到位。

hegc commented 4 years ago

路径还是别用加号加来加去的吧