WebVTT到文本转换器
vttformatter的Python项目详细描述
vttformatter
将WebVTT文件转换为文本删除时间戳和标识符并将文本格式化为段落。
VTT_formatter
是一个python包,可以在命令行中使用python或通过诸如Jupyter Notebook之类的接口在计算机上本地执行,也可以使用Azure Notebooks。
有关在jupyter笔记本、azure笔记本或本地使用anaconda中使用VTT_formatter
的完整说明,请参见wiki。
输入/输出示例
输入
WEBVTT
NOTE duration:"00:00:32.5820000"
NOTE language:en-us
NOTE Confidence: 0.69450831413269
ef04c7c2-a59e-463f-9d27-b5b1259d6777
00:00:03.300 --> 00:00:06.870
Hello.
NOTE Confidence: 0.621036410331726
8a017ebb-1722-4e7f-8984-fc6da39c3489
00:00:08.100 --> 00:00:09.620
Hi there.
NOTE Confidence: 0.713402450084686
d9a1567a-1ebe-40ce-983a-98436bcabcfe
00:00:19.240 --> 00:00:20.240
Can you hear me properly?
NOTE Confidence: 0.536461710929871
b8e0fa64-8c2f-4070-9b0f-922a50f3fcde
00:00:21.930 --> 00:00:23.490
Yeah.
NOTE Confidence: 0.889019846916199
88910870-8af9-48f5-bcc4-a501eda95d3f
00:00:24.670 --> 00:00:28.778
But now my headphones are playing
up, I can still hear you though.
NOTE Confidence: 0.889019846916199
7d633414-089b-4813-9617-9533f5f215c0
00:00:28.778 --> 00:00:32.570
Well, I mean it is crackling. It
will still be recording the audio.
输出
Hello.
Hi there.
Can you hear me properly?
Yeah.
But now my headphones are playing up, I can still hear you though. Well, I mean
it is crackling. It will still be recording the audio.
简单使用
下面的截图显示了vtt格式化程序在jupyter笔记本中的简单实现。这将读取定义的文件,并在与原始文件相同的目录中创建一个新的.txt
文件。
更多信息请参见笔记本here
安装
安装这个vttformatter最简单的方法是使用pip
从PyPI
pip install vttformatter
或者,您可以从GitHub下载最新版本,然后直接安装:
cd vttformatter
pip install -e .
它会在您的用户空间中安装pyscse的可编辑(-e)版本。
或者使用
从GitHub克隆最新版本git clone git@github.com:georgiewellock/VTT_formatter.git
以同样的方式安装。
cd vttformatter
pip install -e .
测试
单元测试位于顶层目录tests
中。可以使用
pytest
或
python -m unittest discover
在最上面的目录中。
贡献
错误报告和功能请求
如果您认为发现了错误,请在Issue Tracker上报告。这也是为新功能提出想法或就vtt格式化程序的设计提出问题的地方。糟糕的文档被认为是一个错误,但在要求改进时请尽可能具体。