# Path: common/db.py
# def user_db_prefix():
# def database_name(domain, family):
# def use_db(conn, domain, family, cursor_class = None):
# def create_conn(**kwargs):
#     def __init__(self, db_name):
#     def open(self):
#     def close(self):
# def connection(db_obj):
# class UserDb(object):


import os,codecs
import time, sys
    import urllib
            import pywikibot
    import pywikibot
        import graph
from ws_category import domain_urls as urls
from common_stat import decode_res, disambiguations
from common import db
    from common.pywikibot_utils import safe_put
                
            num_q1 = num - (num_q0 + num_q2 + num_q3 + num_q4 )
            num_naked = num_texts - num_tr - num_disambig
            

            def str_int(nn,ll=6):
                out = str(nn)
                for i in range(ll-len(str(nn))):  out = " "+out
                return out
                
            sa = str_int(num,7)
            sp0 = str_int(num_q0)
            sp1 = str_int(num_q1)
            sp2 = str_int(num_q2,5)
            sp3 = str_int(num_q3+num_q4)
            sp4 = str_int(num_q4)

	    st = str_int(num_tr)
	    s_disambig = str_int(num_disambig)
	    stt = str_int(num_texts)
	    s_percent = str_int( "%.2f"%percent)
	    s_naked = str_int( num_naked )


            if len(dom)==2: dom=" "+dom
	    lines.append("  "+dom+" : %s  %s  %s  %s  %s  %s  |  %s   %s   %s   %s    %s\n"
                         %(sa, sp1, sp2, sp0, sp3, sp4, stt , st, s_naked, s_disambig, s_percent))

            total    += num
            total_q0 += num_q0

# Path: common/db.py
# def user_db_prefix():
# def database_name(domain, family):
# def use_db(conn, domain, family, cursor_class = None):
# def create_conn(**kwargs):
#     def __init__(self, db_name):
#     def open(self):
#     def close(self):
# def connection(db_obj):
# class UserDb(object):


# Path: statistics/gen_stats.py
import os,codecs
import time, sys
    import urllib
            import pywikibot
    import pywikibot
        import graph
from ws_category import domain_urls as urls
from common_stat import decode_res, disambiguations
from common import db
    from common.pywikibot_utils import safe_put

                
            num_q1 = num - (num_q0 + num_q2 + num_q3 + num_q4 )
            num_naked = num_texts - num_tr - num_disambig
            

            def str_int(nn,ll=6):
                out = str(nn)
                for i in range(ll-len(str(nn))):  out = " "+out
                return out
                
            sa = str_int(num,7)
            sp0 = str_int(num_q0)
            sp1 = str_int(num_q1)
            sp2 = str_int(num_q2,5)
            sp3 = str_int(num_q3+num_q4)
            sp4 = str_int(num_q4)

	    st = str_int(num_tr)
	    s_disambig = str_int(num_disambig)
	    stt = str_int(num_texts)
	    s_percent = str_int( "%.2f"%percent)
	    s_naked = str_int( num_naked )


            if len(dom)==2: dom=" "+dom
	    lines.append("  "+dom+" : %s  %s  %s  %s  %s  %s  |  %s   %s   %s   %s    %s\n"
                         %(sa, sp1, sp2, sp0, sp3, sp4, stt , st, s_naked, s_disambig, s_percent))

            total    += num
            total_q0 += num_q0

            total_q1 += num_q1