import json


def read_json(num, filename_to_read = "yelp_academic_dataset_review.json"):
    """ This function takes in two arguments:
            1) num, the number of json object from the dataset that we want
            2) filename_to_read, this is a default argument, the name of the dataset file

        The json objects we read are review object from the Yelp Dataset. We
        want to extract the review text and star rating for each review.

        This function returns a list of tuples, with the form (review, stars)
    """
    f = open(filename_to_read, "r")

    result = []
    for i in range(num):
        string_data = f.readline()
        data = json.loads( string_data )

        review = data["text"]
        stars = data["stars"]

        result.append( (review, stars) )

    return result