<commit_before>function article (passedCity1) {

        $('.news-header').show();
        $('#news1').empty();
        $('#news2').empty();

        var search;
        var country;
        var cityName = passedCity1.name.toLowerCase();
        var biggerthing = passedCity1.bigger_thing;
        switch (cityName) {
            case 'new york city':
                search = "new+york+city";
                country = "\"New%20York%20City\""
                break;
            case 'london':
                search = "london";
                country = "\"London (England)\""
                break;
            case 'hong kong international':
                search = "hong+kong"; 
                country = "\"CHINA\"";
                break;
            default:
                search = cityName;
                country = "\""+biggerthing+"\"";
            
        };

        var today = new Date();
        var dd = today.getDate();
        var mm = today.getMonth(); //January is 0 so this will be a month behind
        var yyyy = today.getFullYear();

        if(dd<10) {
            dd='0'+dd
        } 

        if(mm<10) {
            mm='0'+mm
        } 
        
        past_month = yyyy+mm+dd;
        
        var API_KEY = "dd74b110c07677ce3e0c5c1f94642e26:10:31738630";
        var URL = "http://api.nytimes.com/svc/search/v2/articlesearch.jsonp?callback=svc_search_v2_articlesearch&q=" + search + "&sort=newest&begin_date="+past_month+"&fq=type_of_material:(News)%20AND%20glocations:("+country+")&api-key=" + API_KEY;
       

        $.ajax({
            url: URL,
            data: {},
            dataType: "jsonp",
            jsonpCallback: 'svc_search_v2_articlesearch',
            success: function (response) {
                var numberOfArticles = response.response.docs.length;
                 console.log("Initially found this many articles " + numberOfArticles);

               if (numberOfArticles < 5){
                    console.log("finding more articles by removing geoloc");
                    URL = "http://api.nytimes.com/svc/search/v2/articlesearch.jsonp?callback=svc_search_v2_articlesearch&q=" + search + "%20" + country + "&sort=newest&begin_date="+past_month+"&fq=type_of_material:(News)%20&api-key=" + API_KEY;

                    $.ajax({
                        url: URL,
                        data: {},
                        dataType: "jsonp",
                        jsonpCallback: 'svc_search_v2_articlesearch',
                        success: function (response) {
                            numberOfArticles = response.response.docs.length;
                            console.log("On 2nd search found this many articles " + numberOfArticles);
                            if (numberOfArticles < 5){
                                console.log("finding more articles by searching only country");
                                URL = "http://api.nytimes.com/svc/search/v2/articlesearch.jsonp?callback=svc_search_v2_articlesearch&q=" + country + "&sort=newest&begin_date="+past_month+"&fq=type_of_material:(News)%20&api-key=" + API_KEY;
                                $.ajax({
                                    url: URL,
                                    data: {},
                                    dataType: "jsonp",
                                    jsonpCallback: 'svc_search_v2_articlesearch',
                                    success: function (response) {
                                        numberOfArticles = response.response.docs.length;
                                        console.log("On 3nd search found this many articles " + numberOfArticles);
                                        printArticles(response);
                                    },
                                     error: function (response) {
                                        console.log("News ajax query failed.");
                                    }
                                });
                            } else {//end end <5 if
                                printArticles(response);
                            }
                        },
                        error: function (response) {
                         console.log("News ajax query failed.");
                        }
                    });
                } else { //end if articles < 5

                    printArticles(response);
               }

            },
            error: function (response) {
                console.log("News ajax query failed.");
            }
        });
   
}


function printArticles(response){
    numberOfArticles = response.response.docs.length;
    for (var i = 0; i < 5; i++) {
        var result = response.response.docs[i];
        var id = response.response.docs[i]._id;
        var title = response.response.docs[i].headline.main;
        var abstract = response.response.docs[i].snippet;
        var url = response.response.docs[i].web_url;
        var pubdate = response.response.docs[i].pub_date.split("T")[0];
        var imagesArray = response.response.docs[i].multimedia;

        if (imagesArray.length > 0){<commit_msg>set 3rd fall back to just query bigger thing. Need to make an article loop that fills<commit_after>function article (passedCity1) {

        $('.news-header').show();
        $('#news1').empty();
        $('#news2').empty();

        var search;
        var country;
        var cityName = passedCity1.name.toLowerCase();
        var biggerthing = passedCity1.bigger_thing;
        switch (cityName) {
            case 'new york city':
                search = "new+york+city";
                country = "\"New%20York%20City\""
                break;
            case 'london':
                search = "london";
                country = "\"London (England)\""
                break;
            case 'hong kong international':
                search = "hong+kong"; 
                country = "\"CHINA\"";
                break;
            default:
                search = cityName;
                country = biggerthing;
            
        };

        var today = new Date();
        var past = today.setDate(today.getDate()-15);
        var pastDate = new Date(past);
        var dd = pastDate.getDate();
        var mm = pastDate.getMonth() + 1; //January is 0 so this will be a month behind
        var yyyy = pastDate.getFullYear();

        if(dd<10) {
            dd='0'+dd
        } 

        if(mm<10) {
            mm='0'+mm
        } 
        
        past_month = yyyy+mm+dd;
        
        var API_KEY = "dd74b110c07677ce3e0c5c1f94642e26:10:31738630";
        var URL = "http://api.nytimes.com/svc/search/v2/articlesearch.jsonp?callback=svc_search_v2_articlesearch&q=" + search + "&sort=newest&begin_date="+past_month+"&fq=type_of_material:(News)%20AND%20glocations:("+country+")&api-key=" + API_KEY;
       

        $.ajax({
            url: URL,
            data: {},
            dataType: "jsonp",
            jsonpCallback: 'svc_search_v2_articlesearch',
            success: function (response) {
                var numberOfArticles = response.response.docs.length;
                 console.log("Initially found this many articles " + numberOfArticles + " URL= " + URL);

               if (numberOfArticles < 5){ //FIRST <5 IF
                    
                    URL = "http://api.nytimes.com/svc/search/v2/articlesearch.jsonp?callback=svc_search_v2_articlesearch&q=" + search + "%20" + country + "&sort=newest&begin_date="+past_month+"&fq=type_of_material:(News)&api-key=" + API_KEY;
                    console.log("finding more articles by removing geoloc and searching city + bigthing in query. URL= " + URL);

                    $.ajax({
                        url: URL,
                        data: {},
                        dataType: "jsonp",
                        jsonpCallback: 'svc_search_v2_articlesearch',
                        success: function (response) {
                            numberOfArticles = response.response.docs.length;
                            console.log("On 2nd search found this many articles " + numberOfArticles);
                            if (numberOfArticles < 5){ //BEGIN 2ND <5 IF
                                
                                URL = "http://api.nytimes.com/svc/search/v2/articlesearch.jsonp?callback=svc_search_v2_articlesearch&q="+country+"&sort=newest&begin_date="+past_month+"&fq=type_of_material:(News)&api-key=" + API_KEY;
                                // URL = "http://api.nytimes.com/svc/search/v2/articlesearch.jsonp?callback=svc_search_v2_articlesearch&q="+country+"&sort=newest&begin_date="+past_month+"&fq=type_of_material:(News)%20AND%20glocations:("+country+")&api-key=" + API_KEY;   q=countyr and geoloc = country

                                console.log("finding more articles by searching only country as query URL= " + URL);
                                $.ajax({
                                    url: URL,
                                    data: {},
                                    dataType: "jsonp",
                                    jsonpCallback: 'svc_search_v2_articlesearch',
                                    success: function (response) {
                                        numberOfArticles = response.response.docs.length;
                                        console.log("On 3nd search found this many articles " + numberOfArticles);
                                        printArticles(response);
                                    },
                                     error: function (response) {
                                        console.log("News ajax query failed.");
                                    }
                                });
                            } else {//end 2nd <5 if
                                printArticles(response);
                            }
                        },
                        error: function (response) {
                         console.log("News ajax query failed.");
                        }
                    });
                } else { //end if articles < 5

                    printArticles(response);
               }

            },
            error: function (response) {
                console.log("News ajax query failed.");
            }
        });
   
}


function printArticles(response){
    numberOfArticles = response.response.docs.length;
    var loop1;
    if (numberOfArticles > 5) {loop1 = 5} else {loop1 = numberOfArticles}
    for (var i = 0; i < loop1; i++) {
        var result = response.response.docs[i];
        var id = response.response.docs[i]._id;
        var title = response.response.docs[i].headline.main;
        var abstract = response.response.docs[i].snippet;
        var url = response.response.docs[i].web_url;
        var pubdate = response.response.docs[i].pub_date.split("T")[0];
        var imagesArray = response.response.docs[i].multimedia;

        if (imagesArray.length > 0){
{'fraction_non_alphanumeric': 0.11216142519541901, 'fraction_numerical': 0.015179058353026723, 'mean_word_length': 1.3370858113848767, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 29, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2867487', 'n_tokens_mistral': 3052, 'n_tokens_neox': 2821, 'n_words': 557}