def extractFeatures(line): res = [] for (name, spec) in featureCandidates: value = extractor.extract(line, name, spec) res.append(value) # if name in ['age', 'height', 'weight', 'temperature']: # res.append(pow(value, 3)) # res.append(pow(value, 2)) # if value > -7: # res.append(pow(value, .5)) # res.append(pow(value, 1/3)) # else: # res.append(0) # res.append(0) return res
def process_img(img, portals): img_no_bottom = remove_bottom_bar(img) croped_img = crop_resize_img(img_no_bottom) phone_time, raid_time, did_egg_hatch = ex.extract(croped_img) level_img = crop_raid_level(croped_img, did_egg_hatch) raid_level = ex.extract_level(level_img) if raid_level == 0: print(' Error! '.center(40, '*')) print(" Can't read raid level! ".center(40, '*')) print(''.center(40, '*')) coords = detect_circles(img) pokemon_name = None if coords: gym_name = ex.extract_gym_name(img, coords) if portals: max_ratio = 0 for portal in portals: ratio = fuzz.ratio(portal['name'].lower(), gym_name.lower()) if ratio > max_ratio: max_ratio = ratio best_match = portal['name'] if max_ratio >= 0.8: gym_name = best_match else: print('Best gym name match: {}'.format(best_match)) if did_egg_hatch: pokemon_name = find_boss_name(croped_img, raid_level) if pokemon_name == None: print(' Error! '.center(40, '*')) print(" Can't read pokemon name! ".center(40, '*')) print(''.center(40, '*')) raid_hour = get_time(phone_time, raid_time) return phone_time, raid_time, did_egg_hatch, gym_name, raid_level, pokemon_name, raid_hour
def main(): extract("../../../resources/html/", "../../../resources/BTE/", bte_treatement)
def main(): extract("../../../resources/html/", "../../../resources/JT/", jt_treatement)
def extractFeatures2009(line): """ Extract features based on specs from 2009 """ return [extractor.extract(line, name, spec) for name, spec in mappings.features["2009"]]
def extractTarget(line): # Extract field rounded down to nearest bucket size return extractor.extract(line, 'timeWithMD', mappings.target[YEAR][1])
def main(): extract("../../../resources/html/", "../../../resources/BS/", bs_treatement)
def extractFeatures2010(line): """ Extract features based on specs from 2010 """ return [extract(line, spec) for _, spec in features["2010"]]
def main(): extract("../../resources/JT/", "../../resources/JT_langid/", jt_langid_treatement)
def main(): extract("../../resources/JT/", "../../resources/JT_trueLg/", jt_truelg_treatement)