pycrossword  0.4
Pure-Python implementation of a crossword puzzle generator and editor
Classes | Variables
pycross.dbapi Namespace Reference

Implements classes to work with SQLite databases created from Hunspell dictionaries. More...

Classes

class  HunspellDownloadSignals
 Container for Qt signals used by HunspellDownloadTask. More...
 
class  HunspellDownloadTask
 A single download task to download one Hunspell dictionary from the remote repo and store it as a DIC file. More...
 
class  HunspellImport
 Main interface to handle downloads and imports of Hunspell dictionaries as SQLite databases. More...
 
class  HunspellImportSignals
 Container for Qt signals used by HunspellImportTask. More...
 
class  HunspellImportTask
 A single import task to import words from a DIC file (downloaded from the Hunspell repo) to an SQLite database *.db file. More...
 
class  Sqlitedb
 SQLite database driver implementation wrapping the standard Python sqlite3 methods. More...
 

Variables

string NEWLINE = '\n'
 str newline symbol More...
 
 SQL_CREATE_TABLES = \
 str SQL query to create default table structure More...
 
 SQL_INSERT_POS = \
 str SQL query to insert part of speech data More...
 
 SQL_INSERT_WORD = \
 str SQL query to insert words and part of speech data More...
 
string SQL_CLEAR_WORDS = f"delete from {SQL_TABLES['words']['table']};"
 str SQL query to clear words More...
 
string SQL_COUNT_WORDS = f"select count(*) from {SQL_TABLES['words']['table']};"
 str SQL query to count entries (words) More...
 
string SQL_GET_WORDS = f"select {SQL_TABLES['words']['table']}.{SQL_TABLES['words']['fid']}, " \
 str SQL query to display all words More...
 
string SQL_GET_POS = f"select * from {SQL_TABLES['pos']['table']};"
 str SQL query to display all POS More...
 
string HUNSPELL_REPO = 'https://raw.githubusercontent.com/wooorm/dictionaries/main'
 str Hunspell dic repo URL More...
 

Detailed Description

Implements classes to work with SQLite databases created from Hunspell dictionaries.

pycrossword can download raw DIC files from the repo for each available language and convert them to SQLite database files (*.db) stored locally in pycross/assets/dic. Each language is denoted by its 2-character short name, e.g. 'en' = English, 'de' = German (deutsch), 'ru' = Russian, etc. So a file stored as pycross/assets/dic/it.db means there is an Italian word source (database) installed and usable to create crosswords. By default, a Hunspell DIC file represents a list of words followed by part-of-speech markers, e.g.:

 confederacy/SM
 confederate/M
 confer/S
 conferee/SM
 conference/MGS
 ...
 

See part-of-speech names: utils::globalvars::POS Accordingly, the default structure of the SQLite DB file is as follows:

 1. Table 'tpos': parts of speeches
   * Field 'id': unique record ID
   * Field 'pos': short part-of-speech name, e.g. 'N' (=noun)
   * Field 'posdesc': full part-of-speech name, e.g. 'Noun'
 2. Table 'twords': words
   * Field 'id': unique record ID
   * Field 'word': word proper (in lower case), e.g. 'conference'
   * Field 'idpos': cross-reference to a part of speech ('id' field in 'tpos' table)
 

See default table and field names: utils::globalvars::SQL_TABLES

Variable Documentation

◆ HUNSPELL_REPO

string pycross.dbapi.HUNSPELL_REPO = 'https://raw.githubusercontent.com/wooorm/dictionaries/main'

str Hunspell dic repo URL

◆ NEWLINE

string pycross.dbapi.NEWLINE = '\n'

str newline symbol

◆ SQL_CLEAR_WORDS

string pycross.dbapi.SQL_CLEAR_WORDS = f"delete from {SQL_TABLES['words']['table']};"

str SQL query to clear words

◆ SQL_COUNT_WORDS

string pycross.dbapi.SQL_COUNT_WORDS = f"select count(*) from {SQL_TABLES['words']['table']};"

str SQL query to count entries (words)

◆ SQL_CREATE_TABLES

pycross.dbapi.SQL_CREATE_TABLES = \

str SQL query to create default table structure

◆ SQL_GET_POS

string pycross.dbapi.SQL_GET_POS = f"select * from {SQL_TABLES['pos']['table']};"

str SQL query to display all POS

◆ SQL_GET_WORDS

string pycross.dbapi.SQL_GET_WORDS = f"select {SQL_TABLES['words']['table']}.{SQL_TABLES['words']['fid']}, " \

str SQL query to display all words

◆ SQL_INSERT_POS

pycross.dbapi.SQL_INSERT_POS = \

str SQL query to insert part of speech data

◆ SQL_INSERT_WORD

pycross.dbapi.SQL_INSERT_WORD = \

str SQL query to insert words and part of speech data