Skip to content

Commit

Permalink
updated userguide notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
georgiewellock committed Jul 8, 2019
1 parent d3c6baf commit 57361c5
Showing 1 changed file with 45 additions and 3 deletions.
48 changes: 45 additions & 3 deletions VTT_formatter.ipynb
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## VTT formatter\n",
"\n",
"This VTT formatter takes a WEBVTT transcript and creates a formatted text file which contains the messages without the time stamps and identifiers. \n",
"\n",
"The `.vtt` file is read into the `VttFormatter` class using the `import_file` method. This opend the file and appends each line in the file to a list.\n",
"This list is looped over and each line is added to a dictionary depending on the information contained in the line using the `create_dictionary` method. \n",
"The text is the reformatted to ensure the text flows conversationally based on the start/stop time stamps contained in the original file using the `format_text` method and the reformatted text is written to a new `.txt` file using the name of the original file in the `reformat_vtt` method.\n",
"\n",
"The simplest way to reformat a `.vtt` file to a `.txt` file is to use the following:\n",
"\n",
"```python\n",
"from vttformatter.vttformatter import VttFormatter\n",
"filename = 'path_to_file.vtt'\n",
"vtt = VttFormatter(filename)\n",
"vtt.reformat_vtt()\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": 1,
Expand Down Expand Up @@ -125,10 +147,30 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": []
"outputs": [
{
"data": {
"text/plain": [
"['Sorry.',\n",
" 'Yes.',\n",
" 'Picking up your feet.',\n",
" 'Yeah.',\n",
" \"But now my headphones or what the boy, I could it still yeah well. I mean, it's it. It will still be recording the audio. It's just not playing in through the speakers to see something in there, if you click. The 3:00 dots. I saw something that said turn off incoming video so that would turn off.\",\n",
" \"10s of me, so I don't know if that.\",\n",
" 'Yes, yeah, yeah, so you can actually control how you want the recording to go you can.']"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# the reformatted messages are stored as an attribute which can be accessed\n",
"vtt.full_messages"
]
}
],
"metadata": {
Expand Down

0 comments on commit 57361c5

Please sign in to comment.