o.l.p.pyNiall : class documentation

Part of otfbot.lib.pyniall_sqlite View Source View In Hierarchy

No class docstring
Method __init__ Undocumented
Method learn learn the words from msg
Method reply learn msg and find a reply to it
Method cleanup cleanup method to commit all unwritten entries to the database
Method _addRelation adds a relation between word1 and word2
Method _addEndRelation adds a relation, that a sentence can end with word
Method _rankWord rank a word by length and probability
Method _getWordRank rank a word by propabiltity of occurance
Method _createRandomSentence recursive function to create a random sentence
Method _createReply reply to a message
def __init__(self, dbname): (source)
Undocumented
def _addRelation(self, word1, word2): (source)
adds a relation between word1 and word2

add a relation, that word1 can be followed by word2

Parametersword1the first word (type: string )
word2the second word (type: string )
def _addEndRelation(self, word): (source)
adds a relation, that a sentence can end with word
Parameterswordthe word (type: string )
def _rankWord(self, word): (source)
rank a word by length and probability
Parameterswordthe word (type: string )
Returns (type: float )
def _getWordRank(self, word): (source)
rank a word by propabiltity of occurance
Parameterswordthe word (type: string )
Returns (type: float )
def _createRandomSentence(self, index, sentence, forward=True): (source)
recursive function to create a random sentence
Parametersindexdatabase-index of the last/first word (type: int )
sentencethe sentence so far (type: string )
forwardappend or prepend? forward=True appends to the sentence (type: bool )
def _createReply(self, msg): (source)
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

Parametersmsgthe msg to reply to (type: string )
def learn(self, msg): (source)
learn the words from msg

learns the new words from msg, and add the new relations between the words.

Parametersmsgthe message (type: string )
def reply(self, msg): (source)
learn msg and find a reply to it
Parametersmsgthe message (type: string )
def cleanup(self): (source)
cleanup method to commit all unwritten entries to the database
API Documentation for OtfBot, generated by pydoctor at 2011-05-03 16:14:29.