class documentation
class pyNiall: (source)
Undocumented
Method | __init__ |
Undocumented |
Method | cleanup |
cleanup method to commit all unwritten entries to the database |
Method | learn |
learn the words from msg |
Method | reply |
learn msg and find a reply to it |
Instance Variable | cur |
Undocumented |
Instance Variable | db |
Undocumented |
Method | _add |
adds a relation, that a sentence can end with word |
Method | _add |
adds a relation between word1 and word2 |
Method | _create |
recursive function to create a random sentence |
Method | _create |
reply to a message |
Method | _get |
rank a word by propabiltity of occurance |
Method | _rank |
rank a word by length and probability |
learn the words from msg
learns the new words from msg, and add the new relations between the words.
Parameters | |
msg:string | the message |
adds a relation between word1 and word2
add a relation, that word1 can be followed by word2
Parameters | |
word1:string | the first word |
word2:string | the second word |
recursive function to create a random sentence
Parameters | |
index:int | database-index of the last/first word |
sentence:string | the sentence so far |
forward:bool | append or prepend? forward=True appends to the sentence |
reply to a message
use msg to create an appropriate reply. first the function tries to identify the most important word. then it grows the answer forward and backwards around the word
Parameters | |
msg:string | the msg to reply to |