#NEWLINE# def ensure_indexes( self ) : #NEWLINE# #INDENT# c = self . cursor ( ) #NEWLINE# c . execute ( 'DROP INDEX IF EXISTS learn_index' ) #NEWLINE# token_ids = ',' . join ( [ ( 'token%d_id' % i ) for i in xrange ( self . order ) ] ) #NEWLINE# c . execute ( ( '\nCREATE UNIQUE INDEX IF NOT EXISTS nodes_token_ids on nodes\n    (%s)' % token_ids ) ) #NEWLINE# c . execute ( '\nCREATE UNIQUE INDEX IF NOT EXISTS edges_all_next ON edges\n    (next_node, prev_node, has_space, count)' ) #NEWLINE# c . execute ( '\nCREATE UNIQUE INDEX IF NOT EXISTS edges_all_prev ON edges\n    (prev_node, next_node, has_space, count)' )