| |
Methods defined here:
- __init__(self, username)
- Inizializes the connection to a specific ddbb .
The self is defined.
The name of the database is defined here, and it is defined as a class
variable. The connection is kept opened to allow the user to
execute another actions inside this database. It is necessary to
close the connection through the method closeCon().
Args:
username: name of the database
- closeCon(self)
- Closes the connection
- createTables(self)
- Creates the table if it doesnt exist.
This table is created when the database is created (after the signup)
- deleteWord(self, word)
- This method allows to delete an existing word.
Args:
word: word that the user ask to delete
- dropTables(self)
- This method removes the table "USERS". It is not convenient to use this
method.
- fileToImport(self, file)
- Inizializes the connection to an external ddbb and open the connection.
It is important to know that the actions to be performed later will
be done inside this database if it is not closed through the method
closeCon().
Args:
file: database file
- insWord(self, word, example, meaning, syntaxis, category, when)
- This method inserts a new word inside the table.
Args:
word: new word to be included
example: example in which the word is used
meaning: meaning of the word in the user's native language
syntaxis: type of word (verb, preposition...)
category: level. By default, all words are iniziated with the first
level.
when: day in which the word is created.
- resetLevels(self)
- Updates the level associated with all the words to 1
- restart(self)
- Restarts the connection
- showAll(self)
- This method shows all the words included in a specific database.
Returns:
listWords: List in which all the words are included. Every word is
added as a list:
[word, example, meaning, word type,level,creation day]
Note: We have to take into account that the same word can have different
inputs associated with different meanings or word types.
- showWord(self, word)
- This method shows all the words associated with a specific word name.
Args:
word: This method will show the words with this name.
Returns:
listWords: List in which all the words meeting the requirement are
included. Every word is added as a list:
[word, example, meaning, word type,level,creation day]
Note: We have to take into account that the same word can have different
inputs associated with different meanings or word types.
- showWords(self)
- This method shows all the words included inside the table.
Returns:
listWords: List in which all the word are included. They are ordered
depending on its word name. Every word is added as a list:
[word, example, meaning, word type,level,creation day]
- showWordsAllLevels(self)
- This method allows to show how many words there are for each level
Returns:
stats: dictionary in which we show the level and the number of words
included inside that level.
totalWords: total number of words, regardless the level.
- showWordsAllTypes(self)
- This method allows to show how many words there are for each word type
Returns:
stats: dictionary in which we show the word type and the number of
words included inside that type.
totalWords: total number of words, regardless the word type.
- showWordsByLevel(self, level)
- This method shows all the words associated with a specific level.
Args:
level: This method will show the words with this level.
Returns:
listWords: List in which all the words meeting the requirement are
included. Every word is added as a list:
[word, example, meaning, word type,level,creation day]
- showWordsByLevelwordType(self, level, wordType)
- This method shows all the words associated with a specific level and
word type.
Args:
wordType: This method will show the words with this word type.
level: This method will show the words with this level.
Returns:
listWords: List in which all the words meeting the requirement are
included. Every word is added as a list:
[word, example, meaning, word type,level,creation day]
- showWordswordType(self, wordType)
- This method shows all the words associated with a specific word type.
Args:
wordType: This method will show the words with this word type.
Returns:
listWords: List in which all the words meeting the requirement are
included. Every word is added as a list:
[word, example, meaning, word type,level,creation day]
- updateLevel(self, word, meaning, newLevel)
- Changes the level assigned to a specific word
Args:
word: word whose level will be updated.
meaning: meaning of word whose level will be updated.
newLevel: new level
|