evaluation/evaluate.py
def evaluate_recall(result_file, test_file):
    """ Count number of urls in test found"""
    test_host = set()
    with open(test_file) as lines:
        for line in lines:
            url = line.strip()
            #url = url_normalize(url)
            host = URLUtility.get_tld(url)
            test_host.add(host)  

    found_host = set()
    with open(result_file) as lines:
        for line in lines:
            values = line.strip().split()
            url = values[1]
            #url = url_normalize(url)
            host = URLUtility.get_tld(url)
            found_host.add(host)

    found = 0
    for host in found_host:
        if host in test_host:
            found += 1
            print host, found

    print found, len(test_host)
 Count number of urls in test found
Count number of urls in test found
Count number of urls in test found
def evaluate_recall(result_file, test_file):
    test_host = set()
    with open(test_file) as lines:
        for line in lines:
            url = line.strip()
            host = URLUtility.get_tld(url)
            test_host.add(host)  
    found_host = set()
    with open(result_file) as lines:
        for line in lines:
            values = line.strip().split()
            url = values[1]
            host = URLUtility.get_tld(url)
            found_host.add(host)
    found = 0
    for host in found_host:
        if host in test_host:
            found += 1
            print host, found
    print found, len(test_host)
def evaluate_recall ( result_file , test_file ) : test_host = set ( ) with open ( test_file ) as lines : for line in lines : url = line . strip ( ) host = URLUtility . get_tld ( url ) test_host . add ( host ) found_host = set ( ) with open ( result_file ) as lines : for line in lines : values = line . strip ( ) . split ( ) url = values [ 1 ] host = URLUtility . get_tld ( url ) found_host . add ( host ) found = 0 for host in found_host : if host in test_host : found += 1 print host , found print found , len ( test_host )
Count number of urls in test found
Count number of urls in test found
""" Count number of urls in test found""" #url = url_normalize(url) #url = url_normalize(url)
result_file
test_file