def __init__(self, stdscreen): self.screen = stdscreen curses.curs_set(0) stdscr = curses.initscr() global con, meta con, meta = bcnlp_db.dbinit() submenu_entity_items = [('Get Enitity List', get_entity_list), ('Display Documents', report_func)] submenu_np_items = [('Get Noun Phrases', get_np_list), ('Display Documents', report_func)] submenu_pp_items = [('Get Prepositions', get_pp_list), ('Display_Documents', report_func)] submenu_vp_items = [('Get verb phrases', get_vp_list), ('Display_Documents', report_func)] submenu_wms_items = [ ('Semantic Similarity', get_semantic_similarity), ('Cosine Similarity', get_cosine_similarity), ('Euclidian Similarity', get_euclidian_similarity), ('Manhattan Similarity', get_manhattan_similarity) ] submenu_wms = Menu(submenu_wms_items, self.screen) submenu_simi_items = [('Common Entity List', get_common_entities), ('Similarity measures', submenu_wms.display), ('Display_Documents', report_func)] submenu_util_items = [('Drop Table', drop_table), ('Display_Documents', report_func)] submenu_entity = Menu(submenu_entity_items, self.screen) submenu_np = Menu(submenu_np_items, self.screen) submenu_pp = Menu(submenu_pp_items, self.screen) submenu_vp = Menu(submenu_vp_items, self.screen) submenu_simi = Menu(submenu_simi_items, self.screen) submenu_util = Menu(submenu_util_items, self.screen) main_menu_items = [('Report', report_func), ('Entity', submenu_entity.display), ('POS-Noun', submenu_np.display), ('POS-Prepo', submenu_pp.display), ('POS-Verb', submenu_vp.display), ('Similarity', submenu_simi.display), ('Util', submenu_util.display)] main_menu = Menu(main_menu_items, self.screen) main_menu.display()
row_list.append(row) return row_list ''' def bnGetNumRecordsInTable(table_name, con, meta): psql_cmd = "select count(*) "+ table_name print "psql cmd for getting number of rows ", psql_cmd table_obj = meta.tables[table_name] select_phrase = table_obj.select().count(*) table_name return(con.execute(select_phrase)) ''' if __name__ == "__main__": parser = ArgumentParser(prog='bcnlp_query.py', description='Query the DB') parser.add_argument('--i', action='store', help="... ") parser.add_argument('--outdir', action='store', help="... ") args = parser.parse_args() con, meta = bcnlp_db.dbinit() bnPrintMainTable(con, meta) doc_index = bnGetDocIndexForDoc(con, meta, "13030.Smalltalk.Hugh+Brinkman.txt") print("DOC Index : ", doc_index) # Compare tables bcnlp_db.dbu_execute_dbcmd('compare_two_tables', table1='bcnlp_entity_doc0', table2='bcnlp_entity_doc1')