Part of otfbot.lib.pyniall_sqlite View Source View In Hierarchy
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 |
add a relation, that word1 can be followed by word2
Parameters | word1 | the first word (type: string ) |
word2 | the second word (type: string ) |
Parameters | word | the word (type: string ) |
Parameters | word | the word (type: string ) |
Returns | (type: float ) |
Parameters | word | the word (type: string ) |
Returns | (type: float ) |
Parameters | index | database-index of the last/first word (type: int ) |
sentence | the sentence so far (type: string ) | |
forward | append or prepend? forward=True appends to the sentence (type: bool ) |
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 | the msg to reply to (type: string ) |
learns the new words from msg, and add the new relations between the words.
Parameters | msg | the message (type: string ) |
Parameters | msg | the message (type: string ) |