Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/andelf/PyAIML
/ functions
Functions
97 in github.com/andelf/PyAIML
⨍
Functions
97
◇
Types & classes
5
↓ 46 callers
Function
_testTag
Tests 'tag' by feeding the Kernel 'input'. If the result matches any of the strings in 'outputList', the test passes.
aiml/Kernel.py:1100
↓ 33 callers
Method
_location
Return a string describing the current location in the source file.
aiml/AimlParser.py:77
↓ 27 callers
Method
sub
Translate text, returns the modified text.
aiml/WordSub.py:74
↓ 22 callers
Method
_processElement
Process an AIML element. The first item of the elem list is the name of the element's XML tag. The second item is a dictionary co
aiml/Kernel.py:418
↓ 22 callers
Method
getPredicate
Retrieve the current value of the predicate 'name' from the specified session. If name is not a valid predicate in the session, th
aiml/Kernel.py:182
↓ 12 callers
Method
setPredicate
Set the value of the predicate 'name' in the specified session. If sessionID is not a valid session, it will be created. If
aiml/Kernel.py:193
↓ 10 callers
Method
respond
Return the Kernel's response to the input string.
aiml/Kernel.py:312
↓ 6 callers
Method
learn
Load and learn the contents of the specified AIML file. If filename includes wildcard characters, all matching files will be loade
aiml/Kernel.py:286
↓ 4 callers
Method
_pushWhitespaceBehavior
Push a new string onto the whitespaceBehaviorStack. The string's value is taken from the "xml:space" attribute, if it exists
aiml/AimlParser.py:83
↓ 4 callers
Method
_respond
Private version of respond(), does the real work.
aiml/Kernel.py:367
↓ 4 callers
Function
splitChinese
(s)
aiml/LangSupport.py:21
↓ 3 callers
Method
_addSession
Create a new session with the specified ID string.
aiml/Kernel.py:253
↓ 3 callers
Method
dump
Print all learned patterns, for debugging purposes.
aiml/PatternMgr.py:40
↓ 3 callers
Function
mergeChineseSpace
(s)
aiml/LangSupport.py:44
↓ 3 callers
Method
star
Returns a string, the portion of pattern that was matched by a *. The 'starType' parameter specifies which type of star to find.
aiml/PatternMgr.py:175
↓ 2 callers
Method
_match
Return a tuple (pat, tem) where pat is a list of nodes, starting at the root and leading to the matching pattern, and tem is the
aiml/PatternMgr.py:281
↓ 2 callers
Method
_processThink
Process a <think> AIML element. <think> elements process their contents recursively, and then discard the results and return the e
aiml/Kernel.py:1032
↓ 2 callers
Method
getBotPredicate
Retrieve the value of the specified bot predicate. If name is not a valid bot predicate, the empty string is returned.
aiml/Kernel.py:205
↓ 2 callers
Method
numCategories
Return the number of categories the Kernel has learned.
aiml/Kernel.py:136
↓ 2 callers
Method
numTemplates
Return the number of templates currently stored.
aiml/PatternMgr.py:28
↓ 2 callers
Method
restoreBrain
Attempt to load a previously-saved 'brain' from the specified filename. NOTE: the current contents of the 'brain' will be discarde
aiml/Kernel.py:152
↓ 2 callers
Method
version
Return the Kernel's version string.
aiml/Kernel.py:132
↓ 1 callers
Method
__init__
(self, sessionStore=None)
aiml/Kernel.py:33
↓ 1 callers
Method
_characters
(self, ch)
aiml/AimlParser.py:265
↓ 1 callers
Method
_endElement
Verify that an AIML end element is valid in the current context. Raises an AimlParserError if an illegal end eleme
aiml/AimlParser.py:346
↓ 1 callers
Method
_startElement
(self, name, attr)
aiml/AimlParser.py:132
↓ 1 callers
Method
_update_regex
Build re object based on the keys of the current dictionary.
aiml/WordSub.py:45
↓ 1 callers
Method
_validateElemStart
Test the validity of an element starting inside a <template> element. This function raises an AimlParserError exce
aiml/AimlParser.py:453
↓ 1 callers
Method
add
Add a [pattern/that/topic] tuple and its corresponding template to the node tree.
aiml/PatternMgr.py:91
↓ 1 callers
Method
bootstrap
Prepare a Kernel object for use. If a brainFile argument is provided, the Kernel attempts to load the brain at the specified filen
aiml/Kernel.py:93
↓ 1 callers
Method
dumps
Dump current patterns to a string for saving.
aiml/PatternMgr.py:44
↓ 1 callers
Method
endElement
Wrapper around _endElement which catches errors in _characters() and keeps going.
aiml/AimlParser.py:315
↓ 1 callers
Function
isChinese
(c)
aiml/LangSupport.py:4
↓ 1 callers
Method
loadSubs
Load a substitutions file. The file must be in the Windows-style INI format (see the standard ConfigParser module docs for informa
aiml/Kernel.py:230
↓ 1 callers
Method
loads
Load patterns from a previously dumps()d patterns.
aiml/PatternMgr.py:53
↓ 1 callers
Function
main
()
example2/getweather.py:40
↓ 1 callers
Method
match
Return the template which is the closest match to pattern. The 'that' parameter contains the bot's previous response. The 'topic'
aiml/PatternMgr.py:150
↓ 1 callers
Function
queryLocation
(term)
example2/getweather.py:14
↓ 1 callers
Function
queryRealTimeWeatherInfo
(code)
example2/getweather.py:26
↓ 1 callers
Method
restore
Restore a previously save()d collection of patterns.
aiml/PatternMgr.py:79
↓ 1 callers
Method
save
Dump the current patterns to the file specified by filename. To restore later, use restore().
aiml/PatternMgr.py:64
↓ 1 callers
Method
saveBrain
Dump the contents of the bot's brain to a file on disk.
aiml/Kernel.py:166
↓ 1 callers
Function
sentences
Split the string s into a list of sentences.
aiml/Utils.py:12
↓ 1 callers
Method
setBotName
Set the name of the bot, used to match <bot name="name"> tags in patterns. The name must be a single word!
aiml/PatternMgr.py:32
↓ 1 callers
Method
setBotPredicate
Set the value of the specified bot predicate. If name is not a valid bot predicate, it will be created.
aiml/Kernel.py:214
↓ 1 callers
Method
setEncoding
Set the text encoding to use when encoding strings read from XML. Defaults to 'UTF-8'.
aiml/AimlParser.py:69
↓ 1 callers
Function
showRealTimeWeatherInfo
(info)
example2/getweather.py:35
↓ 1 callers
Method
startElement
(self, name, attr)
aiml/AimlParser.py:108
Method
__call__
Handler invoked for each regex match.
aiml/WordSub.py:63
Method
__init__
(self, encoding = "UTF-8")
aiml/AimlParser.py:23
Method
__init__
Initialize the object, and populate it with the entries in the defaults dictionary.
aiml/WordSub.py:53
Method
__init__
(self)
aiml/PatternMgr.py:20
Method
__setitem__
(self, i, y)
aiml/WordSub.py:67
Method
_deleteSession
Delete the specified session.
aiml/Kernel.py:265
Method
_processBot
Process a <bot> AIML element. Required element attributes: name: The name of the bot predicate to retrieve. <bot> e
aiml/Kernel.py:446
Method
_processCondition
Process a <condition> AIML element. Optional element attributes: name: The name of a predicate to test. value: Th
aiml/Kernel.py:461
Method
_processDate
Process a <date> AIML element. <date> elements resolve to the current date and time. The AIML specification doesn't require any p
aiml/Kernel.py:563
Method
_processFormal
Process a <formal> AIML element. <formal> elements process their contents recursively, and then capitalize the first letter of eac
aiml/Kernel.py:579
Method
_processGender
Process a <gender> AIML element. <gender> elements process their contents, and then swap the gender of any third-person singular p
aiml/Kernel.py:592
Method
_processGet
Process a <get> AIML element. Required element attributes: name: The name of the predicate whose value should be
aiml/Kernel.py:606
Method
_processGossip
Process a <gossip> AIML element. <gossip> elements are used to capture and store user input in an implementation-defined manner, t
aiml/Kernel.py:621
Method
_processId
Process an <id> AIML element. <id> elements return a unique "user id" for a specific conversation. In PyAIML, the user id is the
aiml/Kernel.py:634
Method
_processInput
Process an <input> AIML element. Optional attribute elements: index: The index of the element from the history list to
aiml/Kernel.py:645
Method
_processJavascript
Process a <javascript> AIML element. <javascript> elements process their contents recursively, and then run the results through a
aiml/Kernel.py:668
Method
_processLearn
Process a <learn> AIML element. <learn> elements process their contents recursively, and then treat the result as an AIML file to
aiml/Kernel.py:682
Method
_processLi
Process an <li> AIML element. Optional attribute elements: name: the name of a predicate to query. value: the val
aiml/Kernel.py:696
Method
_processLowercase
Process a <lowercase> AIML element. <lowercase> elements process their contents recursively, and then convert the results to all-l
aiml/Kernel.py:715
Method
_processPerson
Process a <person> AIML element. <person> elements process their contents recursively, and then convert all pronouns in the result
aiml/Kernel.py:728
Method
_processPerson2
Process a <person2> AIML element. <person2> elements process their contents recursively, and then convert all pronouns in the resu
aiml/Kernel.py:748
Method
_processRandom
Process a <random> AIML element. <random> elements contain zero or more <li> elements. If none, the empty string is returned. If
aiml/Kernel.py:768
Method
_processSentence
Process a <sentence> AIML element. <sentence> elements process their contents recursively, and then capitalize the first letter of
aiml/Kernel.py:791
Method
_processSet
Process a <set> AIML element. Required element attributes: name: The name of the predicate to set. <set> elements p
aiml/Kernel.py:811
Method
_processSize
Process a <size> AIML element. <size> elements return the number of AIML categories currently in the bot's brain.
aiml/Kernel.py:829
Method
_processSr
Process an <sr> AIML element. <sr> elements are shortcuts for <srai><star/></srai>.
aiml/Kernel.py:839
Method
_processSrai
Process a <srai> AIML element. <srai> elements recursively process their contents, and then pass the results right back into the A
aiml/Kernel.py:850
Method
_processStar
Process a <star> AIML element. Optional attribute elements: index: Which "*" character in the current pattern should
aiml/Kernel.py:865
Method
_processSystem
Process a <system> AIML element. <system> elements process their contents recursively, and then attempt to execute the results as
aiml/Kernel.py:893
Method
_processTemplate
Process a <template> AIML element. <template> elements recursively process their contents, and return the results. <template> is
aiml/Kernel.py:937
Method
_processText
Process a raw text element. Raw text elements aren't really AIML tags. Text elements cannot contain other elements; instead, the t
aiml/Kernel.py:951
Method
_processThat
Process a <that> AIML element. Optional element attributes: index: Specifies which element from the output history to
aiml/Kernel.py:974
Method
_processThatstar
Process a <thatstar> AIML element. Optional element attributes: index: Specifies which "*" in the <that> pattern to match.
aiml/Kernel.py:1005
Method
_processTopicstar
Process a <topicstar> AIML element. Optional element attributes: index: Specifies which "*" in the <topic> pattern to match.
aiml/Kernel.py:1046
Method
_processUppercase
Process an <uppercase> AIML element. <uppercase> elements process their contents recursively, and return the results with all lowe
aiml/Kernel.py:1073
Method
_processVersion
Process a <version> AIML element. <version> elements return the version number of the AIML interpreter.
aiml/Kernel.py:1087
Method
_wordToRegex
Convert a word to a regex object which matches the word.
aiml/WordSub.py:38
Method
characters
(self, ch)
aiml/AimlParser.py:244
Function
create_parser
Create and return an AIML parser object.
aiml/AimlParser.py:543
Method
dumpsBrain
Dump to a str
aiml/Kernel.py:174
Method
endElementNS
(self, name, qname)
aiml/AimlParser.py:311
Method
getNumErrors
Return the number of errors found while parsing the current document.
aiml/AimlParser.py:65
Method
getSessionData
Return a copy of the session data dictionary for the specified session. If no sessionID is specified, return a dictionary containi
aiml/Kernel.py:270
Method
loadsBrain
Load from str
aiml/Kernel.py:178
Method
resetBrain
Reset the brain to its initial state. This is essentially equivilant to: del(kern) kern = aiml.Kernel()
aiml/Kernel.py:141
Method
setTextEncoding
Set the text encoding used when loading AIML files (Latin-1, UTF-8, etc.).
aiml/Kernel.py:226
Function
splitUnicode
(s)
aiml/LangSupport.py:33
Method
startElementNS
(self, name, qname, attr)
aiml/AimlParser.py:100
Method
verbose
Enable/disable verbose output mode.
aiml/Kernel.py:128