<jupyter_start><jupyter_text>Create MongoDB Database<jupyter_code># Set up database (MongoDB and pymongo must be installed and need to download data from Yelp Dataset Challenge)
client = MongoClient()
client.database_names()
db = client.yelp
collection = db.reviews
# Store data into MongoDB
with open('data/yelp_academic_dataset_review.json') as json_data:   # Specify path to Yelp review data
    count = 0
    for line in json_data:
        count += 1
        if count % 1000 == 0:
            print(count)
        d = json.loads(line)
        collection.insert_one(d)
# Check that the database was created
client.database_names()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.07993966817496229, 'fraction_numerical': 0.010558069381598794, 'mean_word_length': 3.8115942028985508, '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': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '107425', 'license': 'MIT', 'n_tokens_mistral': 218, 'n_tokens_neox': 204, 'n_words': 65, 'path': 'data.ipynb', 'repo_name': 'dohyun0012/Humor-Detection', 'size': '663'}