<jupyter_start><jupyter_text>VTT formatterThis VTT formatter takes a WEBVTT transcript and creates a formatted text file which contains the messages without the time stamps and identifiers. 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.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. 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.The simplest way to reformat a `.vtt` file to a `.txt` file is to use the following:```pythonfrom vttformatter.vttformatter import VttFormatterfilename = 'path_to_file.vtt'vtt = VttFormatter(filename)vtt.reformat_vtt()```<jupyter_code>from vttformatter.vttformatter import VttFormatter
# define the path to the original WEBVTT file
# the updated .txt file will be saved in the same directory as the original
filename = '../Untitled Folder/2.vtt'
#filename = 'test_AutoGeneratedCaption.vtt'
# create a VttFormatter object
vtt = VttFormatter(filename)
# use this method to automatically reformat the .vtt and save the new file
vtt.reformat_vtt()
# this code creates a dictionary for each element in the original file
# the dictionary is stored as an attribute which can be accessed
h =[]
for i in vtt.data_dict['messages']:
    h.append(i['start'])
len(h)
# the reformatted messages are stored as an attribute which can be accessed
vtt.full_messages<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.05909090909090909, 'fraction_numerical': 0.0005681818181818182, 'mean_word_length': 5.289285714285715, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '247063', 'license': 'MIT', 'n_tokens_mistral': 494, 'n_tokens_neox': 478, 'n_words': 237, 'path': 'VTT_formatter.ipynb', 'repo_name': 'georgiewellock/VTT_formatter', 'size': '1760'}