"""CSC148 Lab 1 === CSC148 Summer 2021 === Department of Mathematical and Computational Sciences, University of Toronto Mississauga === Module description === This module contains an extra Python programming exercise based on a set of worksheets from CSC108, from Winter 2018. You'll want to download some of the "Training Text" files we mentioned in the lab handout. The general idea here is to create a *random story generator*, which takes in some text (stored in a "Training Text" file), and then outputs random sentences generated based on word frequencies and positions from that text. We've deliberately left this fairly open-ended, with only some high-level starter code docstrings that are suggestions on how to design your program. If you want a more guided approach, you can work through the worksheets from the CSC108 exercise (keeping in mind the instructions are a little different), or come in to ask for help during office hours! """ def process_training_text(filename: str) -> dict: """Process the training text stored in . Return a dictionary of some kind (up to you!) that allows you to look up the following information: - given two words W1 and W2, find the number of times that W2 appears immediately after W1 in the training text. """ pass def generate_sentence(word_dict: dict, initial_word: str, length: int) -> str: """Generate a random sentence with the given initial word. The returned sentence should contain words. The parameter should be in the same form as the output of process_training_text. Use the following basic algorithm to generate the sentence (but modify as necessary): - Start with initial_word as the "current word" - For the next word, pick a random word from that follows the current word in the training text, with probability proportional to the number of times that word follows the current word. For example, suppose the current word is 'dog', and in the training text 'dog' is followed by 'barks' 3 times and by 'sits' 2 times (and does not occur any other times). Then the next word chosen should be 'barks' with probability 3/5, and 'sits' with probability 2/5. Then, the chosen word becomes the new current word. - Repeat the process until the sentence has enough words. """ pass def generate_story(filename: str) -> str: """Return a randomly generated story from the given training text file. You can pick how many sentences to generate, what the lengths of the sentences should be, etc. """ pass