#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Felix Muzny
10/25/2022
DS 2000
Lecture 14 - movie review program

A program to read and analyze some movie reviews.
"""

# we'll probably do some plotting
import matplotlib.pyplot as plt


REVIEW_FILE = "tickettoparadise.txt"

def read_data(filename):
    """
    Reads text data assuming that you have one review per line.
    Splits on whitespace.

    Parameters
    ----------
    filename : string
        file path to be read in.

    Returns
    -------
    List of reviews/lines
    in the input file.
    """
    file = open(filename, "r")
    reviews = []
    for line in file:
        # split the review on whitespace
        reviews.append(line.strip())
    # close the file in the same function that we opened it in
    file.close()
    return reviews




def main():
    print("We'll implement this!")
    # First, let's write down a roadmap
    data = read_data(REVIEW_FILE)
    print(data[:2])
    print(len(data))
    print()
    
    # Using the movie review data (blackadam.txt and tickettoparadise.txt), write
    # a larger program that will read in each review for the given movie, line-by-line
    # and does two things:
    #     1) Lets the user ask how many times a word exists in the reviews
    #     2) Reports the combined word counts for all reviews for that movie
        
    # some dictionaries for examples
    c1 = {'Black': 1, 'Adam': 1}
    c2 = {'Black': 1, 'Adam': 4, "rules": 1}
    
    # +
    
    # update
    
    
# from now on, we'll always use this "guard" for our call to
# our main function!
if __name__ == "__main__":
    main()