def sql_query(dbname, query):
 import sqlite3
 try:
  path = nltk.data.find(dbname)
  connection = sqlite3.connect(str(path))
  cur = connection.cursor()
  return cur.execute(query)
 except (ValueError, sqlite3.OperationalError):
  import warnings
  warnings.warn((u'Make sure the database file %s is installed and uncompressed.' % dbname))
  raise

def sql_query ( dbname , query ) : import sqlite3 try : path = nltk . data . find ( dbname ) connection = sqlite3 . connect ( str ( path ) ) cur = connection . cursor ( ) return cur . execute ( query ) except ( ValueError , sqlite3 . OperationalError ) : import warnings warnings . warn ( ( u'Make sure the database file %s is installed and uncompressed.' % dbname ) ) raise
execute an sql query over a database .