我有一个名为wavs的文件夹。在同一个文件中,我有格式为xxxxxxx\u a999999的.wav文件名,其中xxxxxxx,a&;9999是变量。wavs文件夹外是一个文本文件,将.wav文件命名为no&;其成绩单格式如下:
(xxxxxxx_a999999 transcript)
(xxxxxxx_a111111 transcript)
...
...
我需要选择一些wav文件(随机)和选择相同的必要的成绩单。我可以使用bash(这是我正在使用的工具箱的风格)或Python。有人能建议我怎么做吗
根据要求,以下是一个具体的例子:
( Arctic_a0001 "Author of the, danger trail, Philip Steels, etc." )
( Arctic_a0002 "Not at this particular case, Tom, apologized, Whittemore." )
( Arctic_a0003 "For the, twentieth time, that evening the two men shook hands." )
( c0589 " But the king refused, saying that the kingdom must go to the oldest son.")
( c0591 " Not until they were both dead, could the kingdom go to the third son.")
假设,我随机选择了3个wav文件,现在我想要这个文本文件中的相关文本
您可以使用
random.choice
从wavs
目录中选取wav文件,然后使用生成器表达式构造dict,然后使用文件名作为索引来查找转录本:相关问题 更多 >
编程相关推荐