コード例 #1
0
ファイル: linreg.py プロジェクト: ataki/hospitalfinder
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
コード例 #2
0
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
コード例 #3
0
ファイル: bte.py プロジェクト: AntoineOrgerit/Web-Scrapping
def main():
    extract("../../../resources/html/", "../../../resources/BTE/",
            bte_treatement)
コード例 #4
0
ファイル: jt.py プロジェクト: AntoineOrgerit/Web-Scrapping
def main():
    extract("../../../resources/html/", "../../../resources/JT/",
            jt_treatement)
コード例 #5
0
ファイル: final.py プロジェクト: ataki/hospitalfinder
def extractFeatures2009(line):
    """
    Extract features based on specs from 2009
    """
    return [extractor.extract(line, name, spec) for name, spec in mappings.features["2009"]]
コード例 #6
0
ファイル: linreg.py プロジェクト: ataki/hospitalfinder
def extractTarget(line):
	# Extract field rounded down to nearest bucket size
	return extractor.extract(line, 'timeWithMD', mappings.target[YEAR][1])
コード例 #7
0
def main():
    extract("../../../resources/html/", "../../../resources/BS/",
            bs_treatement)
コード例 #8
0
ファイル: to_csv.py プロジェクト: ataki/hospitalfinder
def extractFeatures2010(line):
	"""
	Extract features based on specs from 2010
	"""
	return [extract(line, spec) for _, spec in features["2010"]]
コード例 #9
0
def main():
    extract("../../resources/JT/", "../../resources/JT_langid/",
            jt_langid_treatement)
コード例 #10
0
def main():
    extract("../../resources/JT/", "../../resources/JT_trueLg/",
            jt_truelg_treatement)