From ceeb4ee27288d296e50a382247ab2f1c761eb750 Mon Sep 17 00:00:00 2001 From: Ben Cohen Date: Sun, 28 Jul 2019 20:18:07 -0400 Subject: fuck --- app.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/app.py b/app.py index 3d87995..26f3447 100644 --- a/app.py +++ b/app.py @@ -12,22 +12,10 @@ app = Flask(__name__) with open("./data/beer_info_small.json") as beers_json: beer = json.loads(beers_json.read()) -valid_names = set() -# beer_ids = {} -for long_id, val in beer.items(): - valid_names.add(val[0]) - -print(valid_names) with open('./data/name_list.json') as f: name_list = json.load(f) -orig_terms = list([x for x in name_list.keys() if x.split(' — ')[1] in valid_names]) - -search_words = [''.join(f for f in x.lower() if f not in string.punctuation) for x in orig_terms] - -orig_term_map = dict(zip(search_words, orig_terms)) - beers_for_random = [b for b in beer if beer[b][3] > 75] @@ -37,6 +25,18 @@ with open('./data/brewery_names.json') as f: # for id, name in brewery_names.items(): # brewery_ids[name] = id +valid_names = set() +# # beer_ids = {} +for beer_id, vals in beer.items(): + valid_names.add(brewery_names[beer_id.split('-')[0]] + ' — ' + vals[0]) + +orig_terms = list([x for x in name_list.keys() if x in valid_names]) + +search_words = [''.join(f for f in x.lower() if f not in string.punctuation) for x in orig_terms] + +orig_term_map = dict(zip(search_words, orig_terms)) + + ATTRS = ['Barnyardy', -- cgit v1.2.3