wordgensql
index
/home/eberdeed/machinetrans-1.13/machinetrans/parser/wordgensql.py

WordGenSQL:  A base class to generate English sentences.
This base class contains the database management and 
random word selection routines.
Edward C. Eberle <eberdeed@eberdeed.net>
06-24-2016 San Diego California

 
Modules
       
os
postgresql.driver
random
sys
time

 
Classes
       
builtins.object
WordGenSQL

 
class WordGenSQL(builtins.object)
    A base class to generate English sentences.
This base class contains the database management and 
random word selection routines.
 
  Methods defined here:
__init__(self)
Initialize the class, connect to the database and get the data to randomize.
data(self)
Return the generated sentence data.
makesentences(self, choice)
Provide sentence generation code here.
newitem(self, wtype)
Take the tokenized data and choose a random entry.
newvocab(self)
Reinitialize the randomly generated sentence vocabulary.
readdata(self)
Here the data is read.  A token representing the word, and sometimes the entire entry, are
read and then added to a list, which is then added to a dictionary for each class.
wordgen(self, choice)
Choose random data and call makesentence to put 
it in a sentence.  makesentence is defined in a subclass.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
articles = ['a', 'the']
classlist = []
datastr = ''
db = None
genclass = frozenset(['adjectives', 'advsmanner', 'articles', 'comparatives', 'conjunctions', 'contemplatives', ...])
itemvals = {}
namelist = []
sentence = {}
sqlcommand = 'SELECT DISTINCT name FROM {};\n'
sqlcommandadj = "SELECT DISTINCT (name, variety) FROM adjectives ...ariety='comparative') AND wordcase='nominative';\n"
sqlcommandadv = "SELECT DISTINCT name FROM adverbs WHERE variety='manner';\n"
sqlcommandnoun = 'SELECT DISTINCT (name, variety, gender) FROM nouns;\n'
sqlcommandpart = "SELECT DISTINCT (enval, variety) FROM participle...ND gender='masculine' AND wordcase='nominative';\n"
sqlcommandpron = "SELECT DISTINCT (name, gender) FROM pronouns WHERE variety='personal' AND wordcase='nominative';\n"
sqlcommandverb = "SELECT DISTINCT (name, variety, tense) FROM verbs WHERE tense='simple present';\n"
sqlcurrent = ''
subject = True
tmpstr = ''
wordinfo = <machinetrans.data.wordtype.WordType object>