public static void main(String[] args) {
    // Update tokens here from Yelp developers site, Manage API access.
    String consumerKey = "piw-_wbiWBdgr6jDgPC-TQ";
    String consumerSecret = "aitPjddsXFfsaFCmxY-fnWUKlhI";
    String token = "7aipJDTuLYK6fncSBzgCCkMYWRQGJqKB";
    String tokenSecret = "VOR8mzNxRHJ5b_I6P0jX92OQVTM";

    Yelp yelp = new Yelp(consumerKey, consumerSecret, token, tokenSecret);
    //String response = yelp.search("restaurants", 30.361471, -87.164326);
    Vector<String> ids = new Vector<String>();
    if (false) {
      String[] cities = ("Palo Alto,San Francisco,Menlo Park,Mountain View,New York,Atlanta,Chicago,San Jose,Santa Cruz,San Diego,La Jolla,Los Gatos,Santa Clara,Fremont,Boston,Cambridge,Seattle,Portland,Tucson,Dallas,Austin,Houston,Pasadena,Miami,New Orleans,Detroit,Toronto,Vancouver,Olympia,Las Vegas,Salt Lake City,Provo,El Paso,Memphis,Baltimore,Nashville,Denver,Louisville,Milwaukee,Oklahoma City,Albuquerque,Tucson,Fresno,Sacramento,Long Beach,Kansas City,Mesa,Virginia Beach,Colorado Springs,Omaha,Raleigh,Cleveland,Tulsa,Honolulu,Oakland,Minneapolis,Wichita,Arlington,Bakersfield,New Orleans,Anaheim,Tampa,Aurora,Santa Ana,St. Louis,Pittsburgh,Corpus Christi,Riverside,Cincinnati,Lexington,Anchorage,Stockton,Toledo,Saint Paul,Newark,Greensboro,Buffalo,Plano,Lincoln,Henderson,Fort Wayne,Jersey City,St. Petersburg,Chula Vista,Norfolk,Orlando,Chandler,Laredo,Madison,Winston-Salem,Lubbock,Baton Rouge,Durham,Garland,Glendale,Reno,Hialeah,Chesapeake,Scottsdale,North Las Vegas,Irving,Birmingham,Rochester,San Bernadino,Spokane,Gilbert,Arlington,Montgomery,Boise,Richmond,Des Moines,Modesto,Fayetteville,Shreveport,Akron,Tacoma,Aurora,Oxnard,Fontana,Yonkers,Augusta,Mobile,Little Rock,Moreno Valley,Glendale,Amarillo,Huntington Beach,Columbus,Grand Rapids,Tallahassee,Worcester,Newport News,Huntsville,Knoxville,Providence,Santa Clarita,Grand Prairie,Brownsville,Jackson,Overland Park,Garden Grove,Santa Rosa,Chattanooga,Oceanside,Fort Lauderdale,Rancho Cucamonga,Port Saint Lucie,Ontario,Vancouver,Springfield,Lancaster,Eugene").split(",");
      //String[] cities = ("Palo Alto").split(",");
      for (int i = 0; i < cities.length; i++) {
        String response = yelp.searchCity("restaurants", cities[i], 20);
        addBusinessIds(ids, response);
      }
    } else {
      for (String k:yelp.review_cache.keySet()) {
        ids.add(k);
      }
    }
    int[] trainingSizes = {100, 250, 500, 1000, 2500, 5000, 7000, 10000, 11250};
    for (int it2 = 0; it2 < trainingSizes.length; it2++) {
      System.out.println("Got " + ids.size() + " restaurants");
      Vector<Review> reviews = new Vector<Review>();
      yelp.getReviews(ids, reviews);
      System.out.println("Got " + reviews.size() + " reviews");
      int split = reviews.size() / 2;
      
      List<Review> training_reviews = reviews.subList(0, Math.min(trainingSizes[it2],reviews.size() - reviews.size() / 10));
      List<Review> test_reviews = reviews.subList(reviews.size() - reviews.size() / 10, reviews.size());

      Distribution[] models = new Distribution[3];

      yelp.buildModels(models, training_reviews);
      if (it2 == trainingSizes.length - 1) {
        yelp.dumpInterestingWords(models);
      }
      for (int i = 0; i < models.length; i++) {
        //System.out.println("------ distribution" + i);
        //models[i].print();
      }
      yelp.classify(models, training_reviews.size(), test_reviews);
      if (false) {
        String response = yelp.getBusiness("flounders-chowder-house-gulf-breeze");

        System.out.println(response.length());
        System.out.println(response);
        JSONDecoder decoder = new JSONDecoder(response);
        JSONObject result = (JSONObject) decoder.decode();

        Map<String, String> flattened = new TreeMap<String, String>();
        result.flattenTo(flattened, "");

        Set<String> keys = flattened.keySet();
        Iterator<String> it = keys.iterator();
        while (it.hasNext()) {
          String key = (String) it.next();
          System.out.println(key + " = " + flattened.get(key));
        }

        System.out.println("ToJson: " + flattened.toString());
      }
    }
    try {
      yelp.review_file.close();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }