<commit_before><commit_msg>add script to seed database with articles<commit_after>var mongoose = require("mongoose");
var Article = require("./models/article");

var data = [
    {
        userId: "nomac",
        url: "https://www.theatlantic.com/health/archive/2014/03/the-toxins-that-threaten-our-brains/284466/",
        title: "The Toxins That Threaten Our Brains",
        publication: "The Atlantic",
        author: "<NAME>",
        articleDesc: "Leading scientists recently identified a dozen chemicals as being responsible for widespread behavioral and cognitive problems. But the scope of the chemical dangers in our environment is likely even greater. Why children and the poor are most susceptible to neurotoxic exposure that may be costing the U.S. billions of dollars and immeasurable peace of mind.",
        userDesc: "This article is so awesome!! @viraj any thoughts?"
    },
    {
        userId: "nomac",
        url: "https://hackernoon.com/downloading-an-ios-layout-a9b0ede80809",
        title: "Downloading an iOS UI",
        publication: "Hackernoon",
        author: "<NAME>",
        articleDesc: "The purpose of this post is to demonstrate how, with basic code, an iOS UI can be updated or completely redesigned without submitting your app to the review process.",
        userDesc: "I think this is a well researched article"
    },
    {
        userId: "virajs",
        url: "http://www.3quarksdaily.com/3quarksdaily/2017/06/sunday-poem-3.html",
        title: "Ode to the Cat",
        publication: "3quarksdaily",
        author: "<NAME>",
        articleDesc: "The animals, were imperfect",
        userDesc: "Beautiful poem, @embram you like cats you should check this out"
    }
]
function seedDB() {
    // Remove articles from db
    Article.remove({}, (err) => {
        if (err) {
            console.log(err);
        } else {
            console.log("removed articles");
            // Add boilerplate articles to db
            data.forEach((sample) => {
                Article.create(sample, (err, article) => {
                    if (err) {
                        console.log(err);
                    } else {
                        console.log("added an article");
                    }
                });
            });
        }
    });
}


module.exports = seedDB;
{'fraction_non_alphanumeric': 0.1076194575979337, 'fraction_numerical': 0.01248385708136031, 'mean_word_length': 2.1879286694101507, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5571089', 'n_tokens_mistral': 657, 'n_tokens_neox': 617, 'n_words': 209}