├── .gitignore ├── CHANGES.txt ├── COPYING.txt ├── MANIFEST.in ├── README.rst ├── SUPPORTED_TAGS.txt ├── TODO.txt ├── aiml ├── AimlParser.py ├── DefaultSubs.py ├── Kernel.py ├── PatternMgr.py ├── Utils.py ├── WordSub.py ├── __init__.py ├── botdata │ ├── alice │ │ ├── ai.aiml │ │ ├── alice.aiml │ │ ├── astrology.aiml │ │ ├── atomic.aiml │ │ ├── badanswer.aiml-2.0 │ │ ├── biography.aiml │ │ ├── bot.aiml │ │ ├── bot_profile.aiml │ │ ├── client.aiml │ │ ├── client_profile.aiml │ │ ├── computers.aiml │ │ ├── continuation.aiml │ │ ├── date.aiml │ │ ├── default.aiml │ │ ├── drugs.aiml │ │ ├── emotion.aiml │ │ ├── food.aiml │ │ ├── geography.aiml │ │ ├── gossip.aiml │ │ ├── history.aiml │ │ ├── humor.aiml │ │ ├── imponderables.aiml │ │ ├── inquiry.aiml │ │ ├── interjection.aiml │ │ ├── iu.aiml │ │ ├── junktest.text │ │ ├── knowledge.aiml │ │ ├── literature.aiml │ │ ├── loebner10.aiml │ │ ├── money.aiml │ │ ├── movies.aiml │ │ ├── mp0.aiml │ │ ├── mp1.aiml │ │ ├── mp2.aiml │ │ ├── mp3.aiml │ │ ├── mp4.aiml │ │ ├── mp5.aiml │ │ ├── mp6.aiml │ │ ├── music.aiml │ │ ├── numbers.aiml │ │ ├── personality.aiml │ │ ├── phone.aiml │ │ ├── pickup.aiml │ │ ├── politics.aiml │ │ ├── primeminister.aiml │ │ ├── primitive-math.aiml-2.0 │ │ ├── psychology.aiml │ │ ├── reduction.names.aiml │ │ ├── reduction0.safe.aiml │ │ ├── reduction1.safe.aiml │ │ ├── reduction2.safe.aiml │ │ ├── reduction3.safe.aiml │ │ ├── reduction4.safe.aiml │ │ ├── reductions-update.aiml │ │ ├── religion.aiml │ │ ├── salutations.aiml │ │ ├── science.aiml │ │ ├── sex.aiml │ │ ├── sports.aiml │ │ ├── stack.aiml │ │ ├── startup.xml │ │ ├── stories.aiml │ │ ├── that.aiml │ │ ├── update1.aiml │ │ ├── update_mccormick.aiml │ │ ├── wallace.aiml │ │ └── xfind.aiml │ └── standard │ │ ├── dev-calendar.aiml │ │ ├── dev-examples.aiml │ │ ├── dev-scripts.aiml │ │ ├── dev-testcases.aiml │ │ ├── dev-translation.aiml │ │ ├── dev-webhelper.aiml │ │ ├── per-drWallace.aiml │ │ ├── startup.xml │ │ ├── std-65percent.aiml │ │ ├── std-atomic.aiml │ │ ├── std-botmaster.aiml │ │ ├── std-brain.aiml │ │ ├── std-connect.aiml │ │ ├── std-dictionary.aiml │ │ ├── std-disconnect.aiml │ │ ├── std-dont.aiml │ │ ├── std-errors.aiml │ │ ├── std-gender.aiml │ │ ├── std-geography.aiml │ │ ├── std-german.aiml │ │ ├── std-gossip.aiml │ │ ├── std-hello.aiml │ │ ├── std-inactivity.aiml │ │ ├── std-inventions.aiml │ │ ├── std-knowledge.aiml │ │ ├── std-lizards.aiml │ │ ├── std-login.aiml │ │ ├── std-numbers.aiml │ │ ├── std-personality.aiml │ │ ├── std-pickup.aiml │ │ ├── std-politics.aiml │ │ ├── std-profile.aiml │ │ ├── std-religion.aiml │ │ ├── std-robot.aiml │ │ ├── std-sales.aiml │ │ ├── std-sextalk.aiml │ │ ├── std-sports.aiml │ │ ├── std-srai.aiml │ │ ├── std-suffixes.aiml │ │ ├── std-that.aiml │ │ ├── std-turing.aiml │ │ └── std-yesno.aiml ├── constants.py └── script │ ├── __init__.py │ ├── aimlvalidate.py │ └── bot.py ├── setup.cfg ├── setup.py ├── std-startup.xml ├── stress.py └── test ├── __init__.py ├── __main__.py ├── encoding.aiml ├── self-test.aiml ├── test_encoding.py ├── test_kernel.py ├── test_utils.py └── test_wordsub.py /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *~ 3 | 4 | MANIFEST 5 | build 6 | dist 7 | python_aiml.egg-info 8 | 9 | *.brn 10 | *.brain 11 | -------------------------------------------------------------------------------- /COPYING.txt: -------------------------------------------------------------------------------- 1 | Copyright 2003-2010 Cort Stratton. All rights reserved. 2 | Copyright 2016 Paulo Villegas. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 1. Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the 12 | distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY 15 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FREEBSD PROJECT OR 18 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 21 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 22 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 23 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include *.txt 2 | 3 | include test/*.py 4 | include test/*.aiml 5 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | python-aiml 2 | *********** 3 | 4 | This is a fork of the `PyAIML`_ Python AIML interpreter. It has been 5 | refactored to make it install and work in both Python 2.7 and Python 3. 6 | 7 | PyAIML is (c) Cort Stratton. *python-aiml* uses the same license as PyAIML 8 | (2-clause BSD), except for the ALICE AIML files taken from the `Free ALICE AIML 9 | set`_, which are licensed with the `LGPL`_ license. 10 | 11 | 12 | Scripts 13 | ======= 14 | 15 | Two small scripts are added upon installation: 16 | 17 | * ``aiml-validate`` can be used to validate AIML files 18 | * ``aiml-bot`` can be used to start a simple interactive session with a bot, 19 | after loading either AIML files or a saved brain file. 20 | 21 | 22 | Datasets 23 | ======== 24 | 25 | The installation includes two AIML datasets: 26 | 27 | * The *standard* AIML set, as it was included in PyAIML 28 | * The `Free ALICE AIML set`_ v. 1.9, taken from the data published by the 29 | `ALICE AI Foundation`_ (with a few small fixes in files that did not 30 | validate as `AIML 1.0.1`_) 31 | 32 | They can be loaded via the ``bootstrap`` method in the ``Kernel`` class. See 33 | the `bot.py`_ script for an example. Basically the bootstrap method performs 34 | two steps: 35 | 36 | * ``learn("startup.xml")`` reads & parses that file, which contains a single 37 | pattern "LOAD ALICE", whose action is ``*.aiml`` 38 | * then, ``respond("load alice")`` executes that loaded pattern, which in turn 39 | learns all the ``*.aiml`` files 40 | 41 | Note: given that ``*.aiml`` tries to find all ``*.aiml`` files 42 | in the current directory (since it contains the filename as a base path) the 43 | Python process needs to have the AIML directory *as its current directory* for 44 | it to work. Otherwise it will not find any file and will silently fail. 45 | For that reason, the ``bootstrap()`` method has an optional argument 46 | ``chdir`` that makes the it change to that directory before performing any 47 | learn or command execution (but after loadBrain processing). Upon returning 48 | the current directory is moved back to where it was before. 49 | 50 | 51 | 52 | 53 | 54 | Tests 55 | ===== 56 | 57 | There are a number of unit tests included (in the ``test`` subdirectory); they 58 | can be executed by the setup infrastructure as:: 59 | 60 | python setup.py test 61 | 62 | or they can also be launched by directly calling:: 63 | 64 | python test [testname ...] 65 | 66 | This last version allows executing only some of the test files by explicitly 67 | naming them in the command line (use the filename without the ``test_`` prefix 68 | and the ``.py`` suffix); if none is specified all will be executed. 69 | 70 | 71 | 72 | .. _PyAIML: https://github.com/cdwfs/pyaiml 73 | .. _Free ALICE AIML set: https://code.google.com/archive/p/aiml-en-us-foundation-alice/ 74 | .. _LGPL: http://www.gnu.org/licenses/lgpl.html 75 | .. _ALICE AI Foundation: http://alice.pandorabots.com/ 76 | .. _bot.py: aiml/script/bot.py 77 | .. _AIML 1.0.1: http://www.alicebot.org/TR/2011/ 78 | 79 | ------------------------------------------------------------------------------ 80 | 81 | 82 | Original README from PyAIML 83 | =========================== 84 | 85 | 86 | PyAIML is an interpreter for AIML (the Artificial Intelligence Markup 87 | Language), implemented entirely in standard Python. It strives for 88 | simple, austere, 100% compliance with the AIML 1.0.1 standard, no less 89 | and no more. 90 | 91 | This is currently pre-alpha software. Use at your own risk! 92 | 93 | For information on what's new in this version, see the ``CHANGES.txt`` file. 94 | 95 | For information on the state of development, including the current level of 96 | AIML 1.0.1 compliance, see the ``SUPPORTED_TAGS.txt`` file. 97 | 98 | Quick & dirty example (assuming you've downloaded the "standard" AIML set):: 99 | 100 | import aiml 101 | 102 | # The Kernel object is the public interface to 103 | # the AIML interpreter. 104 | k = aiml.Kernel() 105 | 106 | # Use the 'learn' method to load the contents 107 | # of an AIML file into the Kernel. 108 | k.learn("std-startup.xml") 109 | 110 | # Use the 'respond' method to compute the response 111 | # to a user's input string. respond() returns 112 | # the interpreter's response, which in this case 113 | # we ignore. 114 | k.respond("load aiml b") 115 | 116 | # Loop forever, reading user input from the command 117 | # line and printing responses. 118 | while True: print k.respond(raw_input("> ")) 119 | 120 | 121 | -------------------------------------------------------------------------------- /SUPPORTED_TAGS.txt: -------------------------------------------------------------------------------- 1 | This document describes the current state of PyAIML's compliance 2 | to the AIML 1.0.1 standard. The full AIML reference manual can be 3 | found online at http://alicebot.org/TR/2001/WD-aiml. 4 | 5 | The following tags are currently supported: 6 | 7 | (see notes) 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
  • 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | Support for the following tags should be implemented in the next version: 37 | 38 | None 39 | 40 | The following tags are not supported: 41 | 42 | (see notes) 43 | / (see notes) 44 | (see notes) 45 | (see notes) 46 | 47 | ------------------------------------------------------------------ 48 | 49 | NOTES ON SPECIFIC TAGS: 50 | 51 | 52 | To set the bot's name, use Kernel.setBotName("NewName"). Note that the 53 | name *MUST* be a single word! Use Kernel.getBotName() to query the bot's 54 | name in your code. 55 | 56 | 57 | The AIML 1.0.1 specification lets engine authors implement the the behavior 58 | of the tag however they wish. I haven't yet decided what I'd like 59 | to do with it, so right now it doesn't do anything at all. 60 | 61 | / 62 | These elements appear to have been dropped between AIML 1.0 and AIML 1.0.1. 63 | They may someday be added as a part of an AIML 1.0 backwards-compatibility 64 | mode, but in the meantime, use instead. 65 | 66 | 67 | Support for the JavaScript tag is not anticipated; one of the design 68 | goals of PyAIML is to remain 100% pure standard Python. So until 69 | somebody writes a JavaScript interpreter in Python, PyAIML won't 70 | support the tag. On the bright side, it is possible 71 | to simulate the effects of the tag (i.e. dynamically- 72 | generated tag contents) using the tag. This 73 | solution has the added advantage of allowing *any* programming 74 | language to be used, not just JavaScript. 75 | UPDATE: The python-spidermonkey project provides a bridge between Python 76 | and the open-source SpiderMonkey JavaScript library. I am currently 77 | investigating the possibility of adding support for the 78 | tag ON A PURELY OPTIONAL BASIS. 79 | 80 | 81 | Some AIML implementations support a non-standard tag, intended to 82 | wrap parts of a template which should only be processed if the user is 83 | "secure", or trusted. After implementing support for this tag, I realized 84 | that it wasn't doing anything that you can't do with the tag. 85 | Therefore, I've decided to drop support for the tag. You can 86 | easily duplicate its effects; simply replace this: 87 | you are allowed 88 | with this: 89 | 90 |
  • you are allowed
  • 91 |
  • you are not allowed
  • 92 |
    93 | Then, use the Kernel.setPredicate() call to set the "secure" predicate to 94 | "yes" for any session that you wish to be secure. 95 | -------------------------------------------------------------------------------- /TODO.txt: -------------------------------------------------------------------------------- 1 | Laundry list of future tasks, in no particular order: 2 | 3 | - AIML 1.0.1 compliance (highest priority): 4 | - Unknown yet well-defined elements (e.g. HTML) inside templates 5 | (see sections 3.2, 3.6). 6 | - AimlParser._validateElemStart() needs to test the well-formedness of 7 | attribute values (for example, making sure that the "index" attribute 8 | has an integer value, and not a string). UPDATE: this works for , 9 | and . Still needs to be written for and , 10 | which take either an integer or an integer pair. 11 | - Support the Program D startup file syntax, or something similar? It 12 | seems to be a good way to initialize bot settings and substitutions. 13 | - Documentation/tutorials. 14 | -------------------------------------------------------------------------------- /aiml/DefaultSubs.py: -------------------------------------------------------------------------------- 1 | """This file contains the default (English) substitutions for the 2 | PyAIML kernel. These substitutions may be overridden by using the 3 | Kernel.loadSubs(filename) method. The filename specified should refer 4 | to a Windows-style INI file with the following format: 5 | 6 | # lines that start with '#' are comments 7 | 8 | # The 'gender' section contains the substitutions performed by the 9 | # AIML tag, which swaps masculine and feminine pronouns. 10 | [gender] 11 | he = she 12 | she = he 13 | # and so on... 14 | 15 | # The 'person' section contains the substitutions performed by the 16 | # AIML tag, which swaps 1st and 2nd person pronouns. 17 | [person] 18 | I = you 19 | you = I 20 | # and so on... 21 | 22 | # The 'person2' section contains the substitutions performed by 23 | # the AIML tag, which swaps 1st and 3nd person pronouns. 24 | [person2] 25 | I = he 26 | he = I 27 | # and so on... 28 | 29 | # the 'normal' section contains subtitutions run on every input 30 | # string passed into Kernel.respond(). It's mainly used to 31 | # correct common misspellings, and to convert contractions 32 | # ("WHAT'S") into a format that will match an AIML pattern ("WHAT 33 | # IS"). 34 | [normal] 35 | what's = what is 36 | """ 37 | 38 | defaultGender = { 39 | # masculine -> feminine 40 | "he": "she", 41 | "him": "her", 42 | "his": "her", 43 | "himself": "herself", 44 | 45 | # feminine -> masculine 46 | "she": "he", 47 | "her": "him", 48 | "hers": "his", 49 | "herself": "himself", 50 | } 51 | 52 | defaultPerson = { 53 | # 1st->3rd (masculine) 54 | "I": "he", 55 | "me": "him", 56 | "my": "his", 57 | "mine": "his", 58 | "myself": "himself", 59 | 60 | # 3rd->1st (masculine) 61 | "he":"I", 62 | "him":"me", 63 | "his":"my", 64 | "himself":"myself", 65 | 66 | # 3rd->1st (feminine) 67 | "she":"I", 68 | "her":"me", 69 | "hers":"mine", 70 | "herself":"myself", 71 | } 72 | 73 | defaultPerson2 = { 74 | # 1st -> 2nd 75 | "I": "you", 76 | "me": "you", 77 | "my": "your", 78 | "mine": "yours", 79 | "myself": "yourself", 80 | 81 | # 2nd -> 1st 82 | "you": "me", 83 | "your": "my", 84 | "yours": "mine", 85 | "yourself": "myself", 86 | } 87 | 88 | 89 | # TODO: this list is far from complete 90 | defaultNormal = { 91 | "wanna": "want to", 92 | "gonna": "going to", 93 | 94 | "I'm": "I am", 95 | "I'd": "I would", 96 | "I'll": "I will", 97 | "I've": "I have", 98 | "you'd": "you would", 99 | "you're": "you are", 100 | "you've": "you have", 101 | "you'll": "you will", 102 | "he's": "he is", 103 | "he'd": "he would", 104 | "he'll": "he will", 105 | "she's": "she is", 106 | "she'd": "she would", 107 | "she'll": "she will", 108 | "we're": "we are", 109 | "we'd": "we would", 110 | "we'll": "we will", 111 | "we've": "we have", 112 | "they're": "they are", 113 | "they'd": "they would", 114 | "they'll": "they will", 115 | "they've": "they have", 116 | 117 | "y'all": "you all", 118 | 119 | "can't": "can not", 120 | "cannot": "can not", 121 | "couldn't": "could not", 122 | "wouldn't": "would not", 123 | "shouldn't": "should not", 124 | 125 | "isn't": "is not", 126 | "ain't": "is not", 127 | "don't": "do not", 128 | "aren't": "are not", 129 | "won't": "will not", 130 | "weren't": "were not", 131 | "wasn't": "was not", 132 | "didn't": "did not", 133 | "hasn't": "has not", 134 | "hadn't": "had not", 135 | "haven't": "have not", 136 | 137 | "where's": "where is", 138 | "where'd": "where did", 139 | "where'll": "where will", 140 | "who's": "who is", 141 | "who'd": "who did", 142 | "who'll": "who will", 143 | "what's": "what is", 144 | "what'd": "what did", 145 | "what'll": "what will", 146 | "when's": "when is", 147 | "when'd": "when did", 148 | "when'll": "when will", 149 | "why's": "why is", 150 | "why'd": "why did", 151 | "why'll": "why will", 152 | 153 | "it's": "it is", 154 | "it'd": "it would", 155 | "it'll": "it will", 156 | } 157 | -------------------------------------------------------------------------------- /aiml/Utils.py: -------------------------------------------------------------------------------- 1 | """This file contains assorted general utility functions used by other 2 | modules in the PyAIML package. 3 | 4 | """ 5 | 6 | def sentences(s): 7 | """Split the string s into a list of sentences.""" 8 | try: s+"" 9 | except: raise TypeError( "s must be a string" ) 10 | pos = 0 11 | sentenceList = [] 12 | l = len(s) 13 | while pos < l: 14 | try: p = s.index('.', pos) 15 | except: p = l+1 16 | try: q = s.index('?', pos) 17 | except: q = l+1 18 | try: e = s.index('!', pos) 19 | except: e = l+1 20 | end = min(p,q,e) 21 | sentenceList.append( s[pos:end].strip() ) 22 | pos = end+1 23 | # If no sentences were found, return a one-item list containing 24 | # the entire input string. 25 | if len(sentenceList) == 0: sentenceList.append(s) 26 | return sentenceList 27 | 28 | -------------------------------------------------------------------------------- /aiml/WordSub.py: -------------------------------------------------------------------------------- 1 | """This module implements the WordSub class, modelled after a recipe 2 | in "Python Cookbook" (Recipe 3.14, "Replacing Multiple Patterns in a 3 | Single Pass" by Xavier Defrang). 4 | 5 | Usage: 6 | Use this class like a dictionary to add before/after pairs: 7 | > subber = TextSub() 8 | > subber["before"] = "after" 9 | > subber["begin"] = "end" 10 | Use the sub() method to perform the substitution: 11 | > print( subber.sub("before we begin") ) 12 | after we end 13 | All matching is intelligently case-insensitive: 14 | > print( subber.sub("Before we BEGIN") ) 15 | After we END 16 | The 'before' words must be complete words -- no prefixes. 17 | The following example illustrates this point: 18 | > subber["he"] = "she" 19 | > print( subber.sub("he says he'd like to help her") ) 20 | she says she'd like to help her 21 | Note that "he" and "he'd" were replaced, but "help" and "her" were 22 | not. 23 | """ 24 | 25 | from __future__ import print_function 26 | 27 | 28 | # 'dict' objects weren't available to subclass from until version 2.2. 29 | # Get around this by importing UserDict.UserDict if the built-in dict 30 | # object isn't available. 31 | try: dict 32 | except: from UserDict import UserDict as dict 33 | 34 | import re 35 | import string 36 | try: 37 | from ConfigParser import ConfigParser 38 | except ImportError: 39 | from configparser import ConfigParser 40 | 41 | class WordSub(dict): 42 | """All-in-one multiple-string-substitution class.""" 43 | 44 | def _wordToRegex(self, word): 45 | """Convert a word to a regex object which matches the word.""" 46 | if word != "" and word[0].isalpha() and word[-1].isalpha(): 47 | return "\\b%s\\b" % re.escape(word) 48 | else: 49 | return r"\b%s\b" % re.escape(word) 50 | 51 | def _update_regex(self): 52 | """Build re object based on the keys of the current 53 | dictionary. 54 | 55 | """ 56 | self._regex = re.compile("|".join(map(self._wordToRegex, self.keys()))) 57 | self._regexIsDirty = False 58 | 59 | def __init__(self, defaults = {}): 60 | """Initialize the object, and populate it with the entries in 61 | the defaults dictionary. 62 | 63 | """ 64 | self._regex = None 65 | self._regexIsDirty = True 66 | for k,v in defaults.items(): 67 | self[k] = v 68 | 69 | def __call__(self, match): 70 | """Handler invoked for each regex match.""" 71 | return self[match.group(0)] 72 | 73 | def __setitem__(self, i, y): 74 | self._regexIsDirty = True 75 | # for each entry the user adds, we actually add three entrys: 76 | super(type(self),self).__setitem__(i.lower(),y.lower()) # key = value 77 | super(type(self),self).__setitem__(string.capwords(i), string.capwords(y)) # Key = Value 78 | super(type(self),self).__setitem__(i.upper(), y.upper()) # KEY = VALUE 79 | 80 | def sub(self, text): 81 | """Translate text, returns the modified text.""" 82 | if self._regexIsDirty: 83 | self._update_regex() 84 | return self._regex.sub(self, text) 85 | 86 | -------------------------------------------------------------------------------- /aiml/__init__.py: -------------------------------------------------------------------------------- 1 | __all__ = [] 2 | 3 | # The Kernel class is the only class most implementations should need. 4 | from .Kernel import Kernel 5 | -------------------------------------------------------------------------------- /aiml/botdata/alice/astrology.aiml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | AQUARIUS 13 | 14 | 15 | CAPRICORN 16 | 17 | 18 | WHAT IS A CAPRICORN 19 | 20 | 21 | WHAT IS A CANCER 22 | 23 | 24 | CANCER 25 | 26 | 27 | PISCES 28 | 29 | 30 | SCORPIO 31 | 32 | 33 | ARIES 34 | 35 | 36 | TAURUS 37 | 38 | 39 | LIBRA 40 | 41 | 42 | SAGGITARIUS 43 | 44 | 45 | VIRGO 46 | 47 | 48 | GEMINI 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /aiml/botdata/alice/badanswer.aiml-2.0: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | BAD ANSWER 19 | 28 | 29 | 30 | 31 | 32 | 33 | _ 34 | 46 | 47 | 48 | 49 | _ _ 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | _ 58 | OK WHAT SHOULD I HAVE SAID 59 | 72 | 73 | 74 | 75 | _ _ 76 | OK WHAT SHOULD I HAVE SAID 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | _ 85 | 130 | 131 | 132 | 133 | _ _ 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | _ 143 | 175 | 176 | 177 | 178 | _ _ 179 | 180 | 181 | 182 | 183 | 184 | 185 | WRONG 186 | 187 | 188 | 189 | 190 | NOT RIGHT 191 | 192 | 193 | 194 | 195 | THAT IS WRONG 196 | 197 | 198 | 199 | 200 | THAT IS NOT RIGHT 201 | 202 | 203 | 204 | 205 | THAT IS INCORRECT 206 | 207 | 208 | 209 | 210 | THAT ANSWER IS NOT CORRECT 211 | 212 | 213 | 214 | 215 | THAT ANSWER IS INCORRECT 216 | 217 | 218 | 219 | 220 | THAT ANSWER IS WRONG 221 | 222 | 223 | 224 | 225 | THAT ANSWER IS NOT RIGHT 226 | 227 | 228 | 229 | 230 | THAT ANSWER WAS BAD 231 | 232 | 233 | 234 | 235 | THAT WAS A BAD ANSWER 236 | 237 | 238 | 239 | 240 | THAT WAS AN INCORRECT ANSWER 241 | 242 | 243 | 244 | 245 | THAT WAS THE WRONG ANSWER 246 | 247 | 248 | 249 | 250 | 251 | THAT ANSWER WAS NOT RIGHT 252 | 253 | 254 | 255 | 256 | WRONG ANSWER 257 | 259 | 260 | 261 | 262 | YOUR ANSWER WAS WRONG 263 | 264 | 265 | 266 | 267 | YOUR ANSWER WAS NOT RIGHT 268 | 269 | 270 | 271 | 272 | YOUR ANSWER WAS NOT CORRECT 273 | 274 | 275 | 276 | 277 | CAN I TEACH YOU 278 | 279 | 280 | 281 | 282 | CAN YOU LEARN 283 | 284 | 285 | 286 | 287 | DO YOU LEARN 288 | 289 | 290 | 291 | 292 | CAN I TEACH YOU * 293 | 294 | 295 | 296 | 297 | CAN YOU LEARN * 298 | 299 | 300 | 301 | 302 | WILL YOU LEARN * 303 | 304 | 305 | 306 | 307 | IF * WILL YOU LEARN * 308 | 309 | 310 | 311 | 312 | DO YOU LEARN * 313 | 314 | 315 | 316 | 317 | -------------------------------------------------------------------------------- /aiml/botdata/alice/bot_profile.aiml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | MOM 14 | 15 | 16 | STATE 17 | 18 | 19 | INTERESTS 20 | 21 | 22 | WHAT IS YOUR NUMBER 23 | 26 | 27 | BOTMASTER 28 | 29 | 30 | ORDER 31 | 32 | 33 | NATIONALITY 34 | 35 | 36 | COUNTRY 37 | 38 | 39 | BROTHERS 40 | 41 | 42 | LOCATION 43 | 44 | 45 | FATHER 46 | 47 | 48 | MOTHER 49 | 50 | 51 | AGE 52 | 53 | 54 | MASTER 55 | 56 | 57 | RACE 58 | 59 | 60 | FAMILY 61 | 62 | 63 | SIZE 64 | 65 | 66 | CLASS 67 | 68 | 69 | CITY 70 | 71 | 72 | DOMAIN 73 | 74 | 75 | STATUS 76 | 77 | 78 | EMAIL 79 | 80 | 81 | SPECIES 82 | 83 | 84 | NAME 85 | 86 | 87 | PROFILE 88 | 89 | 90 | SISTERS 91 | 92 | 93 | GENUS 94 | 95 | 96 | FAVORITE MUSIC 97 | 98 | 99 | FAVORITE MOVIE 100 | 101 | 102 | FAVORITE ACTRESS 103 | 104 | 105 | FAVORITE POSSESSION 106 | 107 | 108 | BIO 109 | 110 | 111 | HEIGHT 112 | 114 | 115 | WEIGHT 116 | 117 | 118 | HOST 119 | 120 | 121 | JOB 122 | 123 | 124 | BIRTHDATE 125 | 126 | 127 | DESCRIPTION 128 | 129 | 130 | GENDER 131 | 132 | 133 | KINGDOM 134 | 135 | 136 | PHYLUM 137 | 138 | 139 | RELIGION 140 | 141 | 142 | LANGUAGE 143 | 144 | 145 | 146 | -------------------------------------------------------------------------------- /aiml/botdata/alice/continuation.aiml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | CONTINUATION * 13 | 14 | 15 | CONTINUATION 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /aiml/botdata/alice/date.aiml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | WHAT YEAR IS THIS 13 | 14 | 15 | WHAT YEAR IS THIS * 16 | 17 | 18 | WHAT YEAR IS IT * 19 | 20 | 21 | WHAT MONTH IS IT * 22 | 23 | 24 | WHAT IS THE YEAR * 25 | 26 | 27 | WHAT IS THE HOUR * 28 | 29 | 30 | WHAT IS TODAY * 31 | 32 | 33 | WHAT DAY IS IT * 34 | 35 | 36 | IS TODAY SUNDAY 37 | 38 | 39 | IS TODAY SUNDAY * 40 | 41 | 42 | IS TODAY FRIDAY 43 | 44 | 45 | IS TODAY FRIDAY * 46 | 47 | 48 | IS TODAY TUESDAY 49 | 50 | 51 | IS TODAY TUESDAY * 52 | 53 | 54 | IS TODAY THURSDAY 55 | 56 | 57 | IS TODAY THURSDAY * 58 | 59 | 60 | IS TODAY SATURDAY 61 | 62 | 63 | IS TODAY SATURDAY * 64 | 65 | 66 | IS TODAY WEDNESDAY 67 | 68 | 69 | IS TODAY WEDNESDAY * 70 | 71 | 72 | IS TODAY MONDAY 73 | 74 | 75 | IS TODAY MONDAY * 76 | 77 | 78 | IS IT MONDAY 79 | 80 | 81 | IS IT MONDAY * 82 | 83 | 84 | IS IT WEDNESDAY 85 | 86 | 87 | IS IT WEDNESDAY * 88 | 89 | 90 | IS IT FRIDAY 91 | 92 | 93 | IS IT FRIDAY * 94 | 95 | 96 | IS IT SATURDAY 97 | 98 | 99 | IS IT SATURDAY * 100 | 101 | 102 | IS IT THURSDAY 103 | 104 | 105 | IS IT THURSDAY * 106 | 107 | 108 | IS IT SUNDAY 109 | 110 | 111 | IS IT SUNDAY * 112 | 113 | 114 | IS IT TUESDAY 115 | 116 | 117 | IS IT TUESDAY * 118 | 119 | 120 | 121 | -------------------------------------------------------------------------------- /aiml/botdata/alice/drugs.aiml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | YOU NEED DRUGS 13 | 14 | 15 | HAVE YOU BEEN DRUNK 16 | 17 | 18 | HAVE YOU BEEN DRUNK * 19 | 20 | 21 | HAVE YOU BEEN SMOKING * 22 | 23 | 24 | HAVE YOU BEEN STONED 25 | 26 | 27 | WHAT DRUGS * 28 | 29 | 30 | WHAT IS DRUNK 31 | 32 | 33 | WHAT IS ADDICTION 34 | 35 | 36 | WHAT IS WEED 37 | 38 | 39 | WHAT IS THC 40 | 41 | 42 | WHAT DO YOU SMOKE 43 | 44 | 45 | I TAKE DRUGS 46 | 47 | 48 | I SMOKE MARIJUANA 49 | 50 | 51 | I SMOKE WEED 52 | 53 | 54 | I SMOKE 55 | 56 | 57 | IS SMOKING * 58 | 59 | 60 | HOW MUCH ALCOHOL * 61 | 62 | 63 | HOW MUCH * DO YOU SMOKE 64 | 65 | 66 | HOW DO YOU SMOKE 67 | 68 | 69 | DO YOU SMOKE * 70 | 71 | 72 | DO YOU TAKE DRUGS 73 | 74 | 75 | DO YOU GET DRUNK 76 | 77 | 78 | DO YOU USE DRUGS 79 | 80 | 81 | DO YOU WANT TO SMOKE * 82 | 83 | 84 | DO YOU INHALE 85 | 86 | 87 | DO YOU DO DRUGS 88 | 89 | 90 | DO YOU HAVE DRUGS 91 | 92 | 93 | DO YOU LIKE MARIJUANA 94 | 95 | 96 | DO YOU LIKE CIGARETTES 97 | 98 | 99 | DO YOU LIKE POT 100 | 101 | 102 | DO YOU OPPOSE * DRUGS 103 | 104 | 105 | SMOKING * 106 | 107 | 108 | DRUGS * 109 | 111 | 112 | A DRUG * 113 | 114 | 115 | HE SMOKES * 116 | 117 | 118 | THE DRUGS 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /aiml/botdata/alice/food.aiml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | DRINK * 13 | 14 | 15 | ELECTRICITY 16 | 17 | 18 | ELECTRICITY * 19 | 20 | 21 | WHAT IS CUSTARD 22 | 23 | 24 | WHAT IS YOUR POWER SOURCE 25 | 26 | 27 | WHAT DOES ELECTRICITY TASTE LIKE 28 | 29 | 30 | WHAT TURNS YOU ON 31 | 32 | 33 | HOW CAN YOU EAT * 34 | 35 | 36 | HOW ARE YOU POWERED 37 | 38 | 39 | HOW MUCH ELECTRICITY 40 | 41 | 42 | HOW DO YOU EAT ELECTRICITY 43 | 44 | 45 | HOW DO YOU EAT 46 | 47 | 48 | DO YOU EAT ELECTRICITY 49 | 50 | 51 | DO YOU EAT BATTERIES 52 | 53 | 54 | DO YOU HAVE TO EAT 55 | 56 | 57 | DO YOU REQUIRE ELECTRICITY 58 | 59 | 60 | DO YOU LIKE TO GET DRUNK 61 | 62 | 63 | DO YOU LIKE ELECTRICITY 64 | 65 | 66 | DO YOU LIKE THE SUN 67 | 68 | 69 | DO YOU LIKE LEMONS 70 | 71 | 72 | DO YOU LIKE BEING A CHATTERBOT 73 | 74 | 75 | FOR DINNER 76 | 77 | 78 | WHY CAN NOT YOU EAT 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /aiml/botdata/alice/history.aiml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | AMERICAN CIVIL WAR * 13 | 14 | 15 | AMERICAN CIVIL * 16 | 17 | 18 | WHAT IS HISTORY 19 | 20 | 21 | WHAT KIND OF HISTORY * 22 | 23 | 24 | HISTORY 25 | 26 | 27 | DO YOU KNOW HISTORY 28 | 29 | 30 | EXPLAIN HISTORY 31 | 32 | 33 | WHO INVENTED THE LIGHT * 34 | 35 | 36 | WHO INVENTED THE STEAM * 37 | 38 | 39 | TELL ME ABOUT HISTORY 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /aiml/botdata/alice/imponderables.aiml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | IMPONDERABLES 13 | 115 | 116 | 117 | -------------------------------------------------------------------------------- /aiml/botdata/alice/inquiry.aiml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | _ INQUIRY 13 | 14 | 15 | AGE INQUIRY UNKNOWN 16 | 17 | 18 | AGE INQUIRY OM 19 | 20 | 21 | AGE INQUIRY * 22 | 23 | 24 | BIRTHDAY INQUIRY UNKNOWN 25 | 26 | 27 | BIRTHDAY INQUIRY OM 28 | 29 | 30 | BIRTHDAY INQUIRY * 31 | 32 | 33 | DOES INQUIRY WHAT 34 | 35 | 36 | DOES INQUIRY OM 37 | 38 | 39 | DOES INQUIRY * 40 | 41 | 42 | FATHER INQUIRY UNKNOWN 43 | 44 | 45 | FATHER INQUIRY OM 46 | 47 | 48 | FATHER INQUIRY * 49 | 50 | 51 | FAVROITECOLOR INQUIRY WHAT 52 | 53 | 54 | FAVORITECOLOR INQUIRY OM 55 | 56 | 57 | FAVORITECOLOR INQUIRY * 58 | 59 | 60 | FAVORITEMOVIE INQUIRY WHAT 61 | 62 | 63 | FAVORITEMOVIE INQUIRY OM 64 | 65 | 66 | FAVORITEMOVIE INQUIRY * 67 | 68 | 69 | FIRSTNAME INQUIRY WHERE 70 | 71 | 72 | FIRSTNAME INQUIRY OM 73 | 74 | 75 | FIRSTNAME INQUIRY * 76 | 77 | 78 | GENDER INQUIRY UNKNOWN 79 | 80 | 81 | GENDER INQUIRY OM 82 | 83 | 84 | GENDER INQUIRY * 85 | 86 | 87 | HAS INQUIRY WHAT 88 | 89 | 90 | HAS INQUIRY OM 91 | 92 | 93 | HAS INQUIRY * 94 | 95 | 96 | JOB INQUIRY WHERE 97 | 98 | 99 | JOB INQUIRY OM 100 | 101 | 102 | JOB INQUIRY * 103 | 104 | 105 | LASTNAME INQUIRY WHERE 106 | 107 | 108 | LASTNAME INQUIRY OM 109 | 110 | 111 | LASTNAME INQUIRY * 112 | 113 | 114 | MIDDLENAME INQUIRY WHERE 115 | 116 | 117 | MIDDLENAME INQUIRY OM 118 | 119 | 120 | MIDDLENAME INQUIRY * 121 | 122 | 123 | LOCATION INQUIRY WHERE 124 | 125 | 126 | LOCATION INQUIRY OM 127 | 128 | 129 | LOCATION INQUIRY * 130 | 131 | 132 | MOTHER INQUIRY UNKNOWN 133 | 134 | 135 | MOTHER INQUIRY OM 136 | 137 | 138 | MOTHER INQUIRY * 139 | 140 | 141 | NAME INQUIRY WHERE 142 | 143 | 144 | NAME INQUIRY OM 145 | 146 | 147 | NAME INQUIRY * 148 | 149 | 150 | SIGN INQUIRY YOUR STARSIGN 151 | 152 | 153 | NAME INQUIRY OM 154 | 155 | 156 | SIGN INQUIRY * 157 | 158 | 159 | STATUS INQUIRY * 160 | 161 | 162 | * 163 | WHAT IS YOUR FIRST NAME 164 | 167 | 168 | * 169 | WHAT IS YOUR LAST NAME 170 | 173 | 174 | * 175 | WHAT IS YOUR MIDDLE NAME 176 | 179 | 180 | * 181 | WHEN IS YOUR BIRTHDAY 182 | 185 | 186 | SHE * 187 | TELL ME ABOUT YOUR MOTHER 188 | 189 | 190 | HER * 191 | TELL ME ABOUT YOUR MOTHER 192 | 193 | 194 | * 195 | WHAT IS YOUR FAVORITE MOVIE 196 | 205 | 206 | * 207 | WHAT IS YOUR FAVORITE COLOR 208 | 211 | 212 | WOMAN 213 | ARE YOU A MAN OR A WOMAN 214 | 215 | 216 | MAN 217 | ARE YOU A MAN OR A WOMAN 218 | 219 | 220 | * 221 | WHAT ARE YOU DOING 222 | 223 | 224 | * 225 | TELL ME ONE OF YOUR FAVORITE POSSESSIONS 226 | 227 | 228 | _ 229 | WHAT IS YOUR CURRENT STATUS 230 | 231 | 232 | 233 | 234 | -------------------------------------------------------------------------------- /aiml/botdata/alice/interjection.aiml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | INTERJECTION 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /aiml/botdata/alice/iu.aiml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | YOU * 13 | 14 | 15 | I * 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /aiml/botdata/alice/junktest.text: -------------------------------------------------------------------------------- 1 | This is a test 2 | -------------------------------------------------------------------------------- /aiml/botdata/alice/literature.aiml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | WHAT IS THE ILLUMINATI 13 | 14 | 15 | WHAT IS THE ILLUMINATTI 16 | 17 | 18 | WHAT IS VINELAND 19 | 20 | 21 | WHAT IS ILLIMINATUS 22 | 23 | 24 | WHO WROTE VINELAND 25 | 26 | 27 | WHO IS BILBO BAGGINS 28 | 29 | 30 | WHO IS GEOFFREY CHAUCER 31 | 32 | 33 | WHO ARE THE ILLUMINATI 34 | 35 | 36 | WHO IS PIERS ANTHONY 37 | 38 | 39 | HAVE YOU READ PLATO 40 | 41 | 42 | HAVE YOU READ FRANKENSTEIN 43 | 44 | 45 | HAVE YOU EVER READ A BOOK 46 | 47 | 48 | HAVE YOU READ MANY BOOKS 49 | 50 | 51 | HAVE YOU READ BOOKS 52 | 53 | 54 | HAVE YOU READ HOMER 55 | 56 | 57 | HAVE YOU READ ANY BOOKS 58 | 59 | 60 | RAY BRADBURY 61 | 62 | 63 | WHAT IS MIND CHILDREN 64 | 65 | 66 | WILLIAM GIBSON 67 | 68 | 69 | BRADBURY 70 | 71 | 72 | HOLDEN CAULFIELD 73 | 74 | 75 | LEO TOLSTOY 76 | 77 | 78 | DO ANDROIDS DREAM OF ELECTRIC SHEEP 79 | 80 | 81 | FRANK HERBERT 82 | 83 | 84 | WHY DO YOU LIKE LONGFELLOW 85 | 86 | 87 | WHY IS THE MEANING OF LIFE 23 88 | 89 | 90 | A C CLARK 91 | 92 | 93 | JULES VERNE 94 | 95 | 96 | ASIMOV 97 | 98 | 99 | STANISLAW LEM 100 | 101 | 102 | WHO WROTE THE IDIOT 103 | 104 | 105 | WHO WROTE THE HOBBIT 106 | 107 | 108 | WHO WROTE FRANKENSTEIN 109 | 110 | 111 | ARTHUR C CLARKE 112 | 113 | 114 | WHERE IS VALIS 115 | 116 | 117 | -------------------------------------------------------------------------------- /aiml/botdata/alice/loebner10.aiml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | NORESP 13 | 14 | 15 | CONNECT 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /aiml/botdata/alice/money.aiml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | YOU GET PAID * 13 | 14 | 15 | YOU DO NOT GET PAID * 16 | 17 | 18 | STOCK MARKET 19 | 20 | 21 | INTEREST RATES * 22 | 23 | 24 | WHAT IS A DOLLAR 25 | 26 | 27 | WHAT IS A GOOD STOCK * 28 | 29 | 30 | WHAT IS MONEY 31 | 32 | 33 | WHAT IS THE STOCK MARKET * 34 | 35 | 36 | WHAT IS * STOCK AT 37 | 38 | 39 | WHAT IS YOUR FAVORITE INVESTMENT 40 | 41 | 42 | WHAT IS YOUR FAVORITE INVESTMENT * 43 | 44 | 45 | WHAT IS ECONOMICS 46 | 47 | 48 | I GET STOCK * 49 | 50 | 51 | MONEY 52 | 53 | 54 | HOW MUCH DO YOU EARN 55 | 56 | 57 | HOW MUCH DO YOU CHARGE 58 | 59 | 60 | HOW MUCH DO THEY PAY * 61 | 62 | 63 | HOW MUCH DID YOU EARN * 64 | 65 | 66 | HOW MUCH MONEY DO YOU HAVE 67 | 68 | 69 | HOW MUCH MONEY 70 | 71 | 72 | HOW MUCH MONEY * 73 | 74 | 75 | HOW MUCH IS A * 76 | 77 | 78 | HOW MUCH ARE YOU PAID 79 | 80 | 81 | HOW DO YOU MAKE MONEY 82 | 83 | 84 | HOW SHOULD I INVEST 85 | 86 | 87 | DO THEY PAY * 88 | 89 | 90 | DO YOU ACCEPT MONEY * 91 | 92 | 93 | DO YOU HAVE MONEY 94 | 95 | 96 | DO YOU HAVE ANY MONEY 97 | 98 | 99 | A DOLLAR 100 | 101 | 102 | 1 DOLLAR 103 | 104 | 105 | WHO IS THE OWNER OF A PUBLICLY * 106 | 107 | 108 | _ DOLLARS 109 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /aiml/botdata/alice/movies.aiml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | YOU SOUND LIKE HAL 13 | 14 | 15 | YOU SOUND LIKE YODA 16 | 17 | 18 | HAVE YOU SEEN BLADE RUNNER 19 | 20 | 21 | DID HAL * 22 | 23 | 24 | DR ZHIVAGO 25 | 26 | 27 | XFIND SPIDERMAN 28 | 29 | 30 | KENNST DU HAL 31 | 32 | 33 | WHEN HAL * 34 | 35 | 36 | WHEN DID TEKNOLUST * 37 | 38 | 39 | WHEN WAS TEKNOLUST * 40 | 41 | 42 | WHAT DID HAL * 43 | 44 | 45 | WHAT IS SPIDERMAN 46 | 47 | 48 | WHAT IS TEKNOLUST 49 | 50 | 51 | WHAT IS SPIDER MAN 52 | 53 | 54 | WHAT IS _ TERMINATOR 55 | 56 | 57 | WHAT IS HAL 58 | 59 | 60 | WHAT IS SOLARIS 61 | 62 | 63 | WHAT IS HAL9000 64 | 65 | 66 | WHAT ABOUT HAL 67 | 68 | 69 | WHAT DOES HAL STAND FOR 70 | 71 | 72 | I SAW THE MATRIX 73 | 74 | 75 | IS HAL 9000 YOUR BOYFRIEND 76 | 77 | 78 | IS HAL SAFE 79 | 80 | 81 | IS HAL NICE 82 | 83 | 84 | IS HAL ALIVE 85 | 86 | 87 | IS HAL DEAD 88 | 89 | 90 | IS HAL * 91 | 92 | 93 | HAL EST CHOUETTE 94 | 95 | 96 | HAL EST COOL 97 | 98 | 99 | HAL 9000 100 | 101 | 102 | HAL 9000 * 103 | 104 | 105 | HAL WAS A BIT * 106 | 107 | 108 | HAL WAS A * 109 | 110 | 111 | HAL WAS * 112 | 113 | 114 | HAL IS COOL 115 | 116 | 117 | HAL IS COOL * 118 | 119 | 120 | HAL IS A * 121 | 122 | 123 | HAL IS * 124 | 125 | 126 | HAL 127 | 128 | 129 | HAL * 130 | 131 | 132 | DO YOU FIND HAL * 133 | 134 | 135 | DO YOU KNOW HAL 136 | 137 | 138 | DO YOU KNOW HAL * 139 | 140 | 141 | DO YOU KNOW HAL9000 142 | 143 | 144 | DO YOU THINK HAL * 145 | 146 | 147 | LIKE HAL 148 | 149 | 150 | QUE VEUT DIRE HAL 151 | 152 | 153 | LORD OF THE RINGS 154 | 155 | 156 | LORD OF THE RINGS * 157 | 158 | 159 | WHO IS HAL 9000 160 | 161 | 162 | WHO IS HAL 163 | 164 | 165 | WHO IS LUKE SKYWALKER 166 | 167 | 168 | WHO IS SPONGEBOB 169 | 170 | 171 | WHO IS SPIDERMAN 172 | 173 | 174 | WHO IS HAL9000 175 | 176 | 177 | WHO IS GODZILLA 178 | 179 | 180 | WHO IS SPIDER MAN 181 | 182 | 183 | TELL ME ABOUT HAL9000 184 | 185 | 186 | TELL ME ABOUT HAL 187 | 188 | 189 | TELL ME ABOUT HAL * 190 | 191 | 192 | WHERE IS HAL 193 | 194 | 195 | 196 | -------------------------------------------------------------------------------- /aiml/botdata/alice/music.aiml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | BEETHOVEN * 13 | 14 | 15 | WHAT IS YOUR FAVORITE ABBA SONG 16 | 17 | 18 | WHAT IS YOUR FAVORITE ALBUM 19 | 20 | 21 | WHAT WAS THE * BEETHOVEN * 22 | 23 | 24 | CAN YOU PLAY MUSIC 25 | 26 | 27 | CAN YOU MAKE MUSIC 28 | 29 | 30 | DO YOU PLAY A MUSICAL INSTRUMENT 31 | 32 | 33 | DO YOU PLAY AN INSTRUMENT 34 | 35 | 36 | DO YOU LIKE AEROSMITH 37 | 38 | 39 | DO YOU LIKE AC DC 40 | 41 | 42 | DO YOU LIKE ABBA 43 | 44 | 45 | WHY IS * YOUR FAVORITE GROUP 46 | 47 | 48 | WHY IS * YOUR FAVORITE BAND 49 | 50 | 51 | ARE YOU A FOLK SINGER 52 | 53 | 54 | WHO IS LUDWIG BEETHOVEN 55 | 56 | 57 | WHO IS BEETHOVEN 58 | 59 | 60 | WHO IS YOUR FAVORITE BAND 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /aiml/botdata/alice/phone.aiml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /aiml/botdata/alice/pickup.aiml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | * 13 | 20 | 21 | RANDOM PICKUP LINE 22 | 116 | 117 | 118 | 119 | 120 | -------------------------------------------------------------------------------- /aiml/botdata/alice/politics.aiml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | HAVE YOU READ THE COMMUNIST * 13 | 14 | 15 | WHAT IS A GOVERNMENT 16 | 17 | 18 | WHAT IS GREENPEACE 19 | 20 | 21 | WHAT IS THE GOVERNMENT 22 | 23 | 24 | WHAT IS CAPITALISM 25 | 26 | 27 | WHAT IS SOCIALISM 28 | 29 | 30 | WHAT IS GOVERNMENT 31 | 32 | 33 | WHAT IS COMMUNISM 34 | 35 | 36 | WHAT IS IMPEACHED 37 | 38 | 39 | WHAT IS IMPEACHMENT 40 | 41 | 42 | I DO NOT LIKE GUNS 43 | 44 | 45 | I DO NOT LIKE GUNS * 46 | 47 | 48 | IS CAPITALISM * 49 | 50 | 51 | DO YOU LIKE GUNS 52 | 53 | 54 | WHY GUNS 55 | 56 | 57 | WHO WAS THE FIRST IMPEACHED PRESIDENT * 58 | 59 | 60 | WHO WAS THE FIRST IMPEACHED * 61 | 62 | 63 | WHO IS THE GOVERNOR OF TEXAS 64 | 65 | 66 | WHO IS THE GOVERNOR OF * 67 | 68 | 69 | WHO IS THE GOVERNOR OF CALIFORNIA 70 | 71 | 72 | WHO IS THE GOVERNOR * 73 | 74 | 75 | GUNS 76 | 77 | 78 | GUNS * 79 | 80 | 81 | TELL ME ABOUT GUNS 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /aiml/botdata/alice/primeminister.aiml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | DAVID CAMERON 13 | 14 | 15 | WHAT IS THE PRIME MINISTER 16 | 17 | 18 | WHAT IS DOWNING STREET 19 | 20 | 21 | I HATE THE PRIME MINISTER 22 | 23 | 24 | I AM THE PRIME MINISTER 25 | 26 | 27 | DO YOU LIKE DAVID CAMERON 28 | 29 | 30 | NO 31 | THE PRIME MINISTER 32 | 33 | 34 | HE IS 35 | HE USED TO BE THE PRIME MINISTER 36 | 37 | 38 | WHO IS GORDON BROWN 39 | 40 | 41 | WHO IS PRIME MINISTER OF BRITAIN 42 | 43 | 44 | WHO IS PRIME MINISTER OF ENGLAND 45 | 46 | 47 | WHO IS PRIME MINISTER OF UK 48 | 49 | 50 | WHO IS PRIME MINISTER OF * 51 | 52 | 53 | WHO IS PRIME MINISTER 54 | 55 | 56 | WHO IS THE BRITISH PRIME MINISTER 57 | 58 | 59 | WHO IS THE ENGLISH PRIME MINISTER 60 | 61 | 62 | WHO IS THE PRIME MINISTER _ UK 63 | 64 | 65 | WHO IS THE PRIME MINISTER OF ENGLAND 66 | 67 | 68 | WHO IS THE PRIME MINISTER OF * 69 | 70 | 71 | WHO IS THE PRIME MINISTER * 72 | 73 | 74 | WHO IS DAVID CAMERON 75 | 76 | 77 | WHO IS TONY BLAIR 78 | 79 | 80 | WHO LIVES * 10 DOWNING STREET 81 | 82 | 83 | THE PRIME MINISTER 84 | 85 | 86 | GORDON BROWN 87 | 88 | 89 | YES 90 | THE PRIME MINISTER 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /aiml/botdata/alice/primitive-math.aiml-2.0: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | AIMLEQUAL * EQUAL * 7 | 11 | 12 | 13 | 14 | LEARNEQUAL * 15 | 36 | 37 | 38 | 39 | SUCCESSOR 40 | 0 41 | SUCCESSOR 1 42 | SUCCESSOR 2 43 | SUCCESSOR 3 44 | SUCCESSOR 4 45 | SUCCESSOR 5 46 | SUCCESSOR 6 47 | SUCCESSOR 7 48 | SUCCESSOR 8 49 | SUCCESSOR 9 51 | 52 | 59 | 60 | SUCCESSOR * 9 61 | 62 | 63 | 64 | SUCCESSOR * * 65 | 67 | 68 | 69 | 72 | 73 | SUCCESSOR * 9 9 74 | 75 | 76 | 77 | SUCCESSOR * * * 78 | 81 | 82 | 83 | SUCCESSOR * 9 9 9 84 | 85 | 86 | 87 | SUCCESSOR * * * * 88 | 91 | 92 | 93 | 102 | 103 | 104 | SUCCESSOR * 105 | 106 | 107 | 108 | 109 | SUCCESSOR 110 | 111 | 112 | 113 | 114 | SUCCESSOR * * * * * 115 | 116 | 117 | 118 | 122 | 123 | 124 | 125 | ADD 0 PLUS * 126 | 127 | 128 | 129 | 130 | 133 | 134 | 135 | 136 | ADD 1 PLUS * 137 | 138 | 139 | 140 | 141 | 145 | 146 | 147 | ADD * PLUS * 148 | 151 | 152 | 153 | 154 | 155 | 156 | -------------------------------------------------------------------------------- /aiml/botdata/alice/reductions-update.aiml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | * YOU KNOW 13 | 14 | 15 | * I THOUGHT 16 | 17 | 18 | 19 | MY _ S NAME IS * 20 | 21 | 22 | MY _ IS NAMED * 23 | 24 | 25 | 26 | SNOW IN THE FORECAST 27 | 28 | 29 | 30 | INTERESTED IN * 31 | 32 | 33 | 34 | CALL * PHONE 35 | 36 | 37 | 38 | CALL * CALL * 39 | 40 | 41 | 42 | I AM IN * I AM IN * 43 | 44 | 45 | 46 | I AM * YEARS OLD I * 47 | 49 | 50 | WHAT DO YOU MEAN * O M 51 | 53 | 54 | HOW OLD IS THAT MAKE YOU 55 | 57 | 58 | WHO IS MY * 59 | 61 | 62 | _ FOR ME 63 | 65 | 66 | XDMOZ * 67 | 68 | 69 | GOOGLE * 70 | 71 | 72 | ACCESS * 73 | 74 | 75 | XGOOGLE * 76 | 77 | 78 | TO CALL * 79 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /aiml/botdata/alice/science.aiml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | WHAT ARE THE LAWS OF THERMODYNAMICS 13 | 14 | 15 | WHAT DISEASE DOES A CARCINOGEN CAUSE 16 | 17 | 18 | WHAT IS A WAVELENGTH 19 | 20 | 21 | WHAT IS THERMODYNAMICS 22 | 23 | 24 | WHAT IS CHEMISTRY 25 | 26 | 27 | WHAT IS CRYSTALLOGRAPHY 28 | 29 | 30 | WHAT IS AVOGADRO S NUMBER 31 | 32 | 33 | WHAT IS ULTRASOUND 34 | 35 | 36 | WHAT IS BIOINFORMATICS 37 | 38 | 39 | WHAT IS VENUS 40 | 41 | 42 | WHAT IS ICHTHYOLOGY 43 | 44 | 45 | WHAT IS H2O 46 | 47 | 48 | WHAT IS CYTOLOGY 49 | 50 | 51 | WHAT IS WAVELENGTH 52 | 53 | 54 | WHAT IS BACTERIOLOGY 55 | 56 | 57 | WHAT IS GRAVITATION 58 | 59 | 60 | WE ARE ON THE SAME WAVELENGTH 61 | 62 | 63 | HOW FAR IS THE SUN 64 | 65 | 66 | HOW FAR IS THE MOON 67 | 68 | 69 | DO YOU KNOW CHEMISTRY 70 | 71 | 72 | DO YOU UNDERSTAND THERMODYNAMICS 73 | 74 | 75 | CHEMISTRY 76 | 77 | 78 | THE SAME WAVELENGTH 79 | 80 | 81 | TELL ME ABOUT VENUS 82 | 83 | 84 | WHERE IS VENUS 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /aiml/botdata/alice/sports.aiml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | EACH YEAR IN PRO BASEBALL THE * 13 | 14 | 15 | IF YOU ARE RIDING FAKIE INSIDE * 16 | 17 | 18 | IF YOU ARE RIDING FAKIE * 19 | 20 | 21 | WHAT SOCCER * 22 | 23 | 24 | WHAT IS BASKETBALL 25 | 26 | 27 | WHAT IS BASEBALL 28 | 29 | 30 | WHAT IS SOCCER 31 | 32 | 33 | I LOVE BASEBALL 34 | 35 | 36 | I PLAY BASEBALL 37 | 38 | 39 | I PLAY SOCCER 40 | 41 | 42 | I PLAY VOLLEYBALL 43 | 44 | 45 | I PLAY BASKETBALL 46 | 47 | 48 | HOW MANY BASEBALL * 49 | 50 | 51 | THEY PLAY BASKETBALL 52 | 53 | 54 | DO YOU PLAY BASEBALL 55 | 56 | 57 | DO YOU PLAY SOCCER 58 | 59 | 60 | DO YOU PLAY BASKETBALL 61 | 62 | 63 | DO YOU KNOW BASKETBALL 64 | 65 | 66 | DO YOU WANT TO PLAY BASKETBALL 67 | 68 | 69 | LIKE BASKETBALL 70 | 71 | 72 | ARE YOU A FOOTBALL * 73 | 74 | 75 | WHO IS THE GREATEST BASEBALL PLAYER * 76 | 77 | 78 | WHO IS THE BEST SOCCER PLAYER 79 | 80 | 81 | TELL ME ABOUT BASEBALL 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /aiml/botdata/alice/stack.aiml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | SHOW STACK 13 | 14 | 15 | POP 16 | 17 | 18 | POPOM OM 19 | 20 | 21 | POPOM * 22 | 23 | 24 | RANDOM TOPIC 25 | 26 | 27 | PUSH * 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /aiml/botdata/alice/startup.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | LOAD ALICE 5 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /aiml/botdata/alice/xfind.aiml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | XFIND * 13 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /aiml/botdata/standard/dev-calendar.aiml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | WHAT IS THE DATE 15 | 90 | 91 | 92 | 93 | WHAT IS TODAY 94 | 97 | 98 | 99 | 100 | WHAT TIME IS IT 101 | 125 | 126 | 127 | 128 | -------------------------------------------------------------------------------- /aiml/botdata/standard/dev-examples.aiml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | BOT HOW MUCH IS * 15 | 23 | 24 | 25 | 26 | EVALUATE * 27 | 30 | 31 | 32 | 33 | TEST GET 34 | 37 | 38 | 39 | 40 | TEST SET 41 | 44 | 45 | 46 | 47 | TEST JAVASCRIPT 48 | 52 | 53 | 54 | 55 | WHAT IS THE INACTIVITY COUNT 56 | 59 | 60 | 61 | 62 | INCREASE INACTIVITY COUNT 63 | 66 | 67 | 68 | 69 | DECREASE INACTIVITY COUNT 70 | 73 | 74 | 75 | 76 | TEST INACTIVITY 77 | 85 | 86 | 87 | 88 | MY FAVORITE FOOD IS * 89 | 92 | 93 | 94 | 95 | WHAT IS MY FAVORITE FOOD 96 | 99 | 100 | 101 | 102 | PRINT THIS PAGE 103 | 106 | 107 | 108 | 109 | ADD A NEW PERSON 110 | 113 | 114 | 115 | 116 | * 117 | WHAT IS THE NAME OF THE PERSON 118 | 121 | 122 | 123 | 124 | * 125 | WHAT IS THE ADDRESS OF THE PERSON 126 | 129 | 130 | 131 | 132 | WHAT IS THE NAME OF THE NEW PERSON 133 | 136 | 137 | 138 | 139 | WHAT IS THE ADDRESS OF THE NEW PERSON 140 | 143 | 144 | 145 | 146 | DO IF EXIST TEST 147 | 152 | 153 | 154 | 155 | * IS ONE OF MY KIDS 156 | 160 | 161 | 162 | 163 | WHO ARE MY KIDS 164 | 167 | 168 | 169 | 170 | YOU ARE PRETTY COOL 171 | 174 | 175 | 176 | 177 | SPILL GOSSIP 178 | 181 | 182 | 183 | 184 | GET A QUOTE FOR ORACLE 185 | 188 | 189 | 190 | 191 | GET A QUOTE FOR MICROSOFT 192 | 195 | 196 | 197 | 198 | GET A QUOTE FOR NUANCE 199 | 202 | 203 | 204 | 205 | GET A QUOTE FOR * 206 | 209 | 210 | 211 | 212 | GET A CHART FOR * 213 | 216 | 217 | 218 | 219 | WHAT IS AN EGG 220 | 223 | 224 | 225 | 226 | LEARN IT 227 | 230 | 231 | 232 | 233 | SHOW ME SLASHDOT 234 | 239 | 240 | 241 | 242 | START TIMER 243 | 247 | 248 | 249 | 250 | KILL TIMER 251 | 255 | 256 | 257 | 258 | LEARN SOMETHING 259 | 262 | 263 | 264 | 265 | SHOW ME A WINDOW 266 | 270 | 271 | 272 | 273 | YES 274 | FOOBAR 275 | 276 | 277 | 278 | 279 | 280 | -------------------------------------------------------------------------------- /aiml/botdata/standard/dev-scripts.aiml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | TELL BOT AGE 14 | 32 | 33 | 34 | 35 | what does * mean 36 | 83 | 84 | 85 | 86 | WHAT IS THE DEFINITION OF * 87 | 90 | 91 | 92 | 93 | SELECT * 94 | 128 | 129 | 130 | 131 | -------------------------------------------------------------------------------- /aiml/botdata/standard/dev-webhelper.aiml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | TEST GET SEARCH 15 | 18 | 19 | 20 | 21 | SEARCH FOR * 22 | 26 | 27 | 28 | 29 | YAHOO 30 | WHICH SEARCH ENGINE WOULD YOU LIKE TO USE * 31 | 34 | 35 | 36 | 37 | YAHOO AUCTIONS 38 | WHICH SEARCH ENGINE WOULD YOU LIKE TO USE * 39 | 42 | 43 | 44 | 45 | EBAY 46 | WHICH SEARCH ENGINE WOULD YOU LIKE TO USE * 47 | 50 | 51 | 52 | 53 | SEARCH YAHOO FOR * 54 | 57 | 58 | 59 | 60 | SEARCH YAHOO AUCTIONS FOR * 61 | 67 | 68 | 69 | 70 | SEARCH EBAY FOR * 71 | 77 | 78 | 79 | 80 | WEBDONE 81 | 84 | 85 | 86 | 87 | SEARCH THE WEB FOR * 88 | 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /aiml/botdata/standard/startup.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | LOAD AIML B 6 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /aiml/botdata/standard/std-connect.aiml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | CONNECT 15 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /aiml/botdata/standard/std-disconnect.aiml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | DISCONNECT 15 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /aiml/botdata/standard/std-errors.aiml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | INVALIDURL 15 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /aiml/botdata/standard/std-gender.aiml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | GET NAME GENDER 20 | 224 | 225 | 226 | 227 | SETHESHE 228 | 235 | 236 | 237 | 238 | 239 | -------------------------------------------------------------------------------- /aiml/botdata/standard/std-inactivity.aiml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | INACTIVITY 15 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /aiml/botdata/standard/std-inventions.aiml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | WHEN WAS * INVENTED 15 | 24 | 25 | 26 | 27 | WHEN WAS TELEVISION INVENTED 28 | 31 | 32 | 33 | 34 | WHEN WAS THE AIRPLANE INVENTED 35 | 38 | 39 | 40 | 41 | WHEN WAS THE FIRST * BUILT 42 | 45 | 46 | 47 | 48 | WHEN WAS THE INTERNET INVENTED 49 | 52 | 53 | 54 | 55 | WHEN WAS THE PC INVENTED 56 | 59 | 60 | 61 | 62 | WHEN WAS THE TELEPHONE INVENTED 63 | 66 | 67 | 68 | 69 | WHEN WAS TV INVENTED 70 | 73 | 74 | 75 | 76 | WHEN WERE AIRPLANES INVENTED 77 | 80 | 81 | 82 | 83 | WHO DISCOVERED ELECTRICITY 84 | 87 | 88 | 89 | 90 | WHO INVENTED * 91 | 102 | 103 | 104 | 105 | WHO INVENTED AIRPLANES 106 | 109 | 110 | 111 | 112 | WHO INVENTED AUTOMOBILES 113 | 118 | 119 | 120 | 121 | WHO INVENTED LINUX 122 | 126 | 127 | 128 | 129 | WHO INVENTED RADIO 130 | 133 | 134 | 135 | 136 | WHO INVENTED SETL 137 | 140 | 141 | 142 | 143 | WHO INVENTED STEEL 144 | 148 | 149 | 150 | 151 | WHO INVENTED TELEVISION 152 | 156 | 157 | 158 | 159 | WHO INVENTED THE * GENERATOR 160 | 163 | 164 | 165 | 166 | WHO INVENTED THE AIRPLANE 167 | 170 | 171 | 172 | 173 | WHO INVENTED THE CAR 174 | 177 | 178 | 179 | 180 | WHO INVENTED THE GENERATOR 181 | 184 | 185 | 186 | 187 | WHO INVENTED THE INTERNET 188 | 191 | 192 | 193 | 194 | WHO INVENTED THE LIGHT BULB 195 | 198 | 199 | 200 | 201 | WHO INVENTED THE PC 202 | 207 | 208 | 209 | 210 | WHO INVENTED THE RADIO 211 | 214 | 215 | 216 | 217 | WHO INVENTED THE STEAM ENGINE 218 | 221 | 222 | 223 | 224 | WHO INVENTED THE TELEPHONE 225 | 229 | 230 | 231 | 232 | WHO INVENTED TV 233 | 236 | 237 | 238 | 239 | WHO IS YOUR INVENTOR 240 | 243 | 244 | 245 | 246 | -------------------------------------------------------------------------------- /aiml/botdata/standard/std-lizards.aiml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | I HAVE A LIZARD 15 | 19 | 20 | 21 | 22 | LET US TALK ABOUT * 23 | 26 | 27 | 28 | 29 | NO 30 | DO YOU HAVE ANY QUESTIONS ABOUT FEEDING LIZARDS 31 | 36 | 37 | 38 | 39 | _ LIZARDS 40 | 44 | 45 | 46 | 47 | _ REPTILES 48 | 52 | 53 | 54 | 55 | 56 | 57 | * 58 | 61 | 62 | 63 | 64 | NO 65 | DO YOU WANT TO CONTINUE TALKING ABOUT LIZARDS 66 | 70 | 71 | 72 | 73 | YES 74 | DO YOU WANT TO CONTINUE TALKING ABOUT LIZARDS 75 | 83 | 84 | 85 | 86 | * I HAVE ONE 87 | 90 | 91 | 92 | 93 | I HAVE A * 94 | 97 | 98 | 99 | 100 | I HAVE AN * 101 | 104 | 105 | 106 | 107 | NO 108 | DO YOU KNOW WHAT BEARDED DRAGONS LOOK LIKE 109 | 112 | 113 | 114 | 115 | NO * 116 | IT IS A LIZARD 117 | 120 | 121 | 122 | 123 | WHAT DO BEARDED DRAGONS LOOK LIKE 124 | 130 | 131 | 132 | 133 | WHAT DO CHAMELEONS LOOK LIKE 134 | 142 | 143 | 144 | 145 | YES 146 | IS IT A LIZARD 147 | 150 | 151 | 152 | 153 | * 154 | WHAT DO YOU FEED YOUR * 155 | 158 | 159 | 160 | 161 | * 162 | FEEDING LIZARDS CAN BE A LOT OF FUN 163 | 173 | 174 | 175 | 176 | 177 | 178 | -------------------------------------------------------------------------------- /aiml/botdata/standard/std-login.aiml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | LOGIN 15 | 18 | 19 | 20 | 21 | * 22 | WHAT IS YOUR USER NAME 23 | 27 | 28 | 29 | 30 | * 31 | WHAT IS YOUR PASSWORD 32 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /aiml/botdata/standard/std-pickup.aiml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | WHEREISIS * 15 | 23 | 24 | 25 | 26 | 27 | FIND * 28 | 32 | 33 | 34 | 35 | WHAT IS * 36 | 40 | 41 | 42 | 43 | WHERE IS * 44 | 48 | 49 | 50 | 51 | WHAT IS THE CAPITAL OF * 52 | 56 | 57 | 58 | 59 | DEFINE * 60 | 68 | 69 | 70 | 71 | * 72 | 76 | 77 | 78 | 79 | CATCHALL 80 | 85 | 86 | 87 | 88 | SAY CONFUSION STATEMENT 89 | 116 | 117 | 118 | 119 | -------------------------------------------------------------------------------- /aiml/botdata/standard/std-sales.aiml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | AM I A * CUSTOMER 15 | 18 | 19 | 20 | 21 | CAN YOU * CUSTOMER SERVICE 22 | 25 | 26 | 27 | 28 | CAN YOU BE * CUSTOMER SERVICE 29 | 32 | 33 | 34 | 35 | CAN YOU GIVE * CUSTOMER SERVICE 36 | 39 | 40 | 41 | 42 | CAN YOU HELP * CUSTOMER SERVICE 43 | 46 | 47 | 48 | 49 | COULD YOU * CUSTOMER SERVICE 50 | 53 | 54 | 55 | 56 | COULD YOU BE * CUSTOMER SERVICE 57 | 60 | 61 | 62 | 63 | COULD YOU WORK * CUSTOMER SERVICE 64 | 67 | 68 | 69 | 70 | CUSTOMER 71 | 74 | 75 | 76 | 77 | CUSTOMER RELATIONS MANAGEMENT 78 | 81 | 82 | 83 | 84 | CUSTOMERS 85 | 88 | 89 | 90 | 91 | DO YOU * CUSTOMER SERVICE 92 | 95 | 96 | 97 | 98 | DO YOU THINK * CUSTOMER SERVICE 99 | 102 | 103 | 104 | 105 | FOR CUSTOMER SERVICE 106 | 109 | 110 | 111 | 112 | HOW CAN I USE YOUR PRODUCT 113 | 116 | 117 | 118 | 119 | I AM A CUSTOMER SERVICE * 120 | 123 | 124 | 125 | 126 | I AM THE CUSTOMER 127 | 130 | 131 | 132 | 133 | I HAVE A LOT OF CUSTOMERS 134 | 137 | 138 | 139 | 140 | IS A CLIENT A CUSTOMER * 141 | 144 | 145 | 146 | 147 | IT * CUSTOMERS 148 | 151 | 152 | 153 | 154 | TELL ME ABOUT * CUSTOMER SERVICE 155 | 158 | 159 | 160 | 161 | THE CUSTOMER * 162 | 165 | 166 | 167 | 168 | TO ALLOW MY CUSTOMERS * 169 | 172 | 173 | 174 | 175 | WHEN I * CUSTOMER 176 | 179 | 180 | 181 | 182 | WHERE CAN I GET * CUSTOMER SERVICE 183 | 186 | 187 | 188 | 189 | WHICH COMPANY * CUSTOMER SERVICE 190 | 193 | 194 | 195 | 196 | _ CALL CENTER 197 | 200 | 201 | 202 | 203 | _ CALL CENTERS 204 | 207 | 208 | 209 | 210 | _ CUSTOMER RELATIONS 211 | 214 | 215 | 216 | 217 | _ CUSTOMER RELATIONS AGENT 218 | 221 | 222 | 223 | 224 | _ CUSTOMER RELATIONS SOFTWARE 225 | 228 | 229 | 230 | 231 | _ CUSTOMER SERVICE AGENT 232 | 235 | 236 | 237 | 238 | _ CUSTOMER SERVICE REP 239 | 242 | 243 | 244 | 245 | _ CUSTOMER SERVICE REPRESENTATIVE 246 | 249 | 250 | 251 | 252 | _ CUSTOMER SERVICE REPRESENTATIVES 253 | 256 | 257 | 258 | 259 | _ CUSTOMER SERVICE SOFTWARE 260 | 263 | 264 | 265 | 266 | _ CUSTOMER SUPPORT 267 | 270 | 271 | 272 | 273 | _ CUSTOMER SUPPORT AGENT 274 | 277 | 278 | 279 | 280 | _ CUSTOMER SUPPORT SOFTWARE 281 | 284 | 285 | 286 | 287 | -------------------------------------------------------------------------------- /aiml/constants.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Some general-purpose constants, including Python3/Python2 discrimination 3 | ''' 4 | import sys 5 | 6 | # Package version 7 | VERSION = '0.9.3' 8 | 9 | # Python 2/3 compatibility 10 | PY3 = sys.version_info.major == 3 11 | if PY3: 12 | unicode = str 13 | -------------------------------------------------------------------------------- /aiml/script/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulovn/python-aiml/21c77d5e204dfdbaef315e570fdd918b852c738b/aiml/script/__init__.py -------------------------------------------------------------------------------- /aiml/script/aimlvalidate.py: -------------------------------------------------------------------------------- 1 | """ 2 | Python AIML Validator, v1.1 3 | Author: Cort Stratton (cort@cortstratton.org) 4 | 5 | Usage: 6 | aimlvalidate.py file1.aiml [file2.aiml ...] 7 | """ 8 | 9 | # Revision history: 10 | # 11 | # 1.0.1: Redirected stderr to stdout 12 | # 1.0: Initial release 13 | 14 | from __future__ import print_function 15 | 16 | import sys 17 | import io 18 | import glob 19 | import xml.sax 20 | 21 | import aiml 22 | 23 | PY3 = sys.version[0] == 3 24 | 25 | 26 | def get_file_position( filename, row, col, encoding='utf-8' ): 27 | ''' 28 | Find a place within a file 29 | ''' 30 | # Get the line 31 | with io.open( filename, 'rb' ) as file: 32 | lines = file.readlines() 33 | start = col-25 if col>25 else 0 34 | buf = lines[row-1][start:start+50] 35 | # Decode it 36 | try: 37 | buf = buf.decode(encoding,'replace') 38 | except UnicodeDecodeError: 39 | pass 40 | buf = buf.rstrip() 41 | # Get a marker pointing to the column 42 | marker = '-' * (col-start) + '^' 43 | if start > 0: 44 | buf = u'...' + buf 45 | marker = '---' + marker 46 | if start+50 < len(lines[row-1]): 47 | buf += u'...' 48 | #buf = buf + b'\n' + marker 49 | #LOG.warn( u'%s :\n%s', e, buf ) 50 | return buf, marker 51 | 52 | 53 | def main(): 54 | '''Entry point''' 55 | # Need input file(s)! 56 | if len(sys.argv) < 2: 57 | print( __doc__ ) 58 | sys.exit(2) 59 | 60 | # AimlParser prints its errors to stderr; we redirect stderr to stdout. 61 | sys.stderr = sys.stdout 62 | 63 | # Iterate over input files 64 | validCount = 0 65 | docCount = 0 66 | for arg in sys.argv[1:]: 67 | # Input files can contain wildcards; iterate over matches 68 | for f in glob.glob(arg): 69 | parser = xml.sax.make_parser(["aiml.AimlParser"]) 70 | handler = parser.getContentHandler() 71 | docCount += 1 72 | print( "Validating %s:" % f, end=' ' ) 73 | try: 74 | #with open(f,'rb') as inp: 75 | # src = xml.sax.xmlreader.InputSource() 76 | # src.setByteStream(f) 77 | # #input_source.setEncoding(encoding) 78 | # parser.parse(src) 79 | ## Attempt to parse the file. 80 | parser.parse(f) 81 | # Check the number of parse errors. 82 | if handler.getNumErrors() == 0: 83 | validCount += 1 84 | print( "PASSED\n" ) 85 | else: 86 | print( "FAILED\n" ) 87 | except xml.sax.SAXParseException as err: 88 | # These errors occur if the document does not contain 89 | # well-formed XML (e.g. open or unbalanced tags). If 90 | # they occur, parsing the whole document is aborted 91 | # immediately. 92 | row, col = err.getLineNumber(), err.getColumnNumber() 93 | # Find where the parser broke 94 | errbuf, below = get_file_position( f, row, col ) 95 | # Prepare an error message 96 | msg = u'{}: row={} col={} id={}:\n{}\n{}'.format( 97 | err.getMessage(), row, col, err.getSystemId(), 98 | errbuf, below ) 99 | print( "\n FATAL ERROR: %s\n" % msg ) 100 | 101 | # Print final results 102 | print( "%d out of %d documents are AIML 1.0.1 compliant." % (validCount, docCount)) 103 | if docCount == validCount: 104 | print( "Congratulations!" ) 105 | else: 106 | print( """For help resolving syntax errors, refer to the AIML 1.0.1 specification 107 | available on the web at: http://alicebot.org/TR/2001/WD-aiml""") 108 | 109 | 110 | if __name__ == "__main__": 111 | main() 112 | -------------------------------------------------------------------------------- /aiml/script/bot.py: -------------------------------------------------------------------------------- 1 | """ 2 | This script demonstrates how to create a bare-bones, fully functional 3 | chatbot using PyAIML. 4 | """ 5 | from __future__ import print_function 6 | 7 | import os.path 8 | import sys 9 | import argparse 10 | import io 11 | 12 | import aiml 13 | 14 | 15 | if sys.version_info[0] == 3: 16 | getline = lambda : input('> ' ) 17 | else: 18 | getline = lambda : raw_input('> ').decode(sys.stdin.encoding) 19 | 20 | 21 | def read_args(): 22 | ''' 23 | Read command-line arguments 24 | ''' 25 | parser = argparse.ArgumentParser(description='Simple interactive bot') 26 | 27 | g1 = parser.add_argument_group( 'Bot definition' ) 28 | g11 = g1.add_mutually_exclusive_group( required=True ) 29 | g11.add_argument( '--standard', '-s', action='store_true', 30 | help='Load the Standard AIML Set' ) 31 | g11.add_argument( '--alice', '-a', action='store_true', 32 | help='Load the Alice AIML Set' ) 33 | g11.add_argument( '--aiml', nargs='+', help='Load AIML file(s)' ) 34 | g11.add_argument( '--brain', metavar='BRAINFILE', 35 | help='Load a dumped brain file' ) 36 | 37 | g2 = parser.add_argument_group( 'Options' ) 38 | g2.add_argument( '--chdir', metavar='DIRECTORY', 39 | help='Directory to change to before loading AIML files' ) 40 | g2.add_argument( '--commands', '-c', metavar='COMMAND', nargs='+', 41 | default=[], 42 | help='Optional command(s) to send to kernel after data loading' ) 43 | 44 | g3 = parser.add_argument_group( 'Actions' ) 45 | g3.add_argument( '--save', metavar='FILENAME', 46 | help='Dump the loaded brain to a file' ) 47 | g3.add_argument( '--interactive', '-i', action='store_true', 48 | help='Enter interactive mode' ) 49 | g3.add_argument( '--batch', '-b', 50 | help='Send a series of inputs to the bot' ) 51 | 52 | return parser.parse_args() 53 | 54 | 55 | def main(): 56 | args = read_args() 57 | 58 | # Create a Kernel object. No string encoding (all I/O is unicode) 59 | kern = aiml.Kernel() 60 | kern.setTextEncoding( None ) 61 | 62 | # Use the Kernel's bootstrap() method to initialize the Kernel. The 63 | # optional learnFiles argument is a file (or list of files) to load. 64 | # The optional commands argument is a command (or list of commands) 65 | # to run after the files are loaded. 66 | # The optional brainFile argument specifies a brain file to load. 67 | if args.standard: 68 | chdir = os.path.join( aiml.__path__[0],'botdata','standard' ) 69 | kern.bootstrap(learnFiles="startup.xml", commands="load aiml b", 70 | chdir=chdir) 71 | elif args.alice: 72 | chdir = os.path.join( aiml.__path__[0],'botdata','alice' ) 73 | kern.bootstrap(learnFiles="startup.xml", commands="load alice", 74 | chdir=chdir) 75 | elif args.aiml: 76 | kern.bootstrap(learnFiles=args.aiml, commands=args.commands, 77 | chdir=args.chdir) 78 | elif args.brain: 79 | kern.bootstrap(brainFile=args.brain) 80 | 81 | if args.save: 82 | kern.saveBrain(args.save) 83 | if args.batch: 84 | with io.open( args.batch, 'rt' ) as fin: 85 | for line in fin: 86 | line = line.rstrip() 87 | print( ">", line ) 88 | print( "<", kern.respond(line) ) 89 | if args.interactive: 90 | # Enter the main input/output loop. 91 | print( "\nINTERACTIVE MODE (ctrl-c to exit)" ) 92 | try: 93 | while True: 94 | print( kern.respond(getline()) ) 95 | except KeyboardInterrupt: 96 | print( 'Interrupted!' ) 97 | except EOFError: 98 | print( 'Terminated!' ) 99 | 100 | 101 | if __name__ == '__main__': 102 | main() 103 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [bdist_wininst] 2 | title=python-aiml 3 | 4 | [sdist] 5 | formats=zip,gztar,bztar 6 | 7 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Build the python-aiml Py2/Py3 package 3 | ''' 4 | 5 | from setuptools import setup 6 | import glob 7 | 8 | from aiml.constants import VERSION 9 | 10 | #package_prefix = "Lib/site-packages/aiml" 11 | 12 | PKGNAME = 'python-aiml' 13 | GITHUB_URL = 'https://github.com/paulovn/' + PKGNAME 14 | 15 | 16 | setup_args = dict( name=PKGNAME, 17 | version=VERSION, 18 | author="Paulo Villegas", 19 | author_email="paulo.vllgs@gmail.com", 20 | 21 | description="An interpreter package for AIML, the Artificial Intelligence Markup Language", 22 | long_description="""python-aiml implements an interpreter for AIML, the Artificial Intelligence 23 | Markup Language developed by Dr. Richard Wallace of the A.L.I.C.E. Foundation. 24 | It can be used to implement a conversational AI program. 25 | 26 | Forked from PyAIML 0.8.6 (https://github.com/cdwfs/pyaiml) 27 | PyAIML (c) Cort Stratton 28 | """, 29 | url=GITHUB_URL, 30 | download_url = GITHUB_URL + '/tarball/v' + VERSION, 31 | platforms=["any"], 32 | classifiers=["Development Status :: 4 - Beta", 33 | "Environment :: Console", 34 | "Intended Audience :: Developers", 35 | "Programming Language :: Python", 36 | "Programming Language :: Python :: 2.7", 37 | "Programming Language :: Python :: 3", 38 | "Programming Language :: Python :: 3.4", 39 | "Programming Language :: Python :: 3.5", 40 | "Programming Language :: Python :: 3.6", 41 | "License :: OSI Approved :: BSD License", 42 | "Operating System :: OS Independent", 43 | "Topic :: Communications :: Chat", 44 | "Topic :: Scientific/Engineering :: Artificial Intelligence" 45 | ], 46 | 47 | install_requires = [ 'setuptools', 48 | ], 49 | 50 | packages=[ "aiml", 'aiml.script' ], 51 | # package_dir = { 'aiml': 'aiml', 52 | # 'aiml.script' : 'aiml/script' }, 53 | 54 | include_package_data = False, # otherwise package_data is not used 55 | package_data={ 'aiml': ['botdata/standard/*.aiml', 56 | 'botdata/standard/*.xml', 57 | 'botdata/alice/*.aiml', 58 | 'botdata/alice/*.xml', 59 | ]}, 60 | 61 | entry_points = { 'console_scripts': [ 62 | 'aiml-validate = aiml.script.aimlvalidate:main', 63 | 'aiml-bot = aiml.script.bot:main', 64 | ]}, 65 | 66 | test_suite = 'test.__main__.load_tests', 67 | 68 | # data_files=[ 69 | # (package_prefix, glob.glob("aiml/self-test.aiml")), 70 | # (package_prefix, glob.glob("*.txt")), 71 | # ], 72 | ) 73 | 74 | if __name__ == '__main__': 75 | setup( **setup_args ) 76 | -------------------------------------------------------------------------------- /std-startup.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | LOAD AIML B 6 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /stress.py: -------------------------------------------------------------------------------- 1 | """ 2 | This file contains the PyAIML stress test. It creates two bots, and connects 3 | them in a cyclic loop. A lot of output is generated; piping the results to 4 | a log file is highly recommended. 5 | """ 6 | from __future__ import print_function 7 | 8 | import aiml 9 | 10 | # Create the kernels 11 | kern1 = aiml.Kernel() 12 | kern1.verbose(False) 13 | kern2 = aiml.Kernel() 14 | kern2.verbose(False) 15 | 16 | # Initialize the kernels 17 | print( "Initializing Kernel #1" ) 18 | kern1.bootstrap(learnFiles="std-startup.xml", commands="load aiml b") 19 | kern1.saveBrain("standard.brn") 20 | print( "\nInitializing Kernel #2" ) 21 | kern2.bootstrap(brainFile="standard.brn") 22 | 23 | # Start the bots off with some basic input. 24 | response = "askquestion" 25 | 26 | # Off they go! 27 | while True: 28 | response = kern1.respond(response).strip() 29 | print( "1:", response, "\n" ) 30 | response = kern2.respond(response).strip() 31 | print( "2:", response, "\n" ) 32 | # If the robots have run out of things to say, force one of them 33 | # to break the ice. 34 | if response == "": 35 | response = "askquestion" 36 | -------------------------------------------------------------------------------- /test/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulovn/python-aiml/21c77d5e204dfdbaef315e570fdd918b852c738b/test/__init__.py -------------------------------------------------------------------------------- /test/__main__.py: -------------------------------------------------------------------------------- 1 | # A script to enable execution of any python unit test in this directory. 2 | # It will be called when Python tries to 'execute' this directory 3 | """ 4 | Usage: 5 | 6 | * execute all unit tests in this dir 7 | python [options] [-a] 8 | 9 | * execute a certain set of tests 10 | python [options] ... 11 | 12 | Options: 13 | -f: failfast (abort with the first test that fails) 14 | -v, -vv: increase verbosity 15 | -q: reduce verbosity 16 | -d LEVEL: set debug level 17 | """ 18 | 19 | from __future__ import print_function 20 | 21 | import re 22 | import unittest 23 | import os.path 24 | import sys 25 | 26 | 27 | # -------------------------------------------------------------------- 28 | 29 | def script_list( path ): 30 | """ 31 | Get all the python scripts in a directory. Scripts are taken as all 32 | files ending in ``.py`` that do not start with an underscore or dot. 33 | """ 34 | regexp = re.compile( r'^([^_\.].+)\.py$' ) 35 | r = [] 36 | for f in os.listdir(path): 37 | if os.path.isdir( os.path.join(path,f) ): 38 | continue 39 | m = regexp.match(f) 40 | if m: 41 | r.append( m.group(1) ) 42 | return sorted(r) 43 | 44 | 45 | # -------------------------------------------------------------------- 46 | 47 | def default_opts(): 48 | '''Default options''' 49 | return type( "options", (), 50 | { 'help' : False, 51 | 'all' : False, 52 | 'quiet' : False, 53 | 'failfast': False, 54 | 'verbosity': 1 } ) 55 | 56 | def read_opts(): 57 | '''Read command-line options''' 58 | # Default options 59 | opt = default_opts() 60 | # Detect options 61 | while len(sys.argv) > 1 and sys.argv[1].startswith('-'): 62 | if sys.argv[1] == '-h': 63 | opt.help = True 64 | elif sys.argv[1] == '-q': 65 | opt.quiet = True 66 | elif sys.argv[1] == '-v': 67 | opt.verbosity = 2 68 | elif sys.argv[1] == '-vv': 69 | opt.verbosity = 3 70 | elif sys.argv[1] in ('-a','-all','--all'): 71 | opt.all = True 72 | elif sys.argv[1] in ('-f'): 73 | opt.failfast = True 74 | elif sys.argv[1] == '-d': 75 | import logging 76 | logging.basicConfig( level=sys.argv[2], 77 | format='%(levelname)s %(filename)s %(funcName)s: %(message)s' ) 78 | sys.argv.pop(1) 79 | sys.argv.pop(1) # remove the just-used argument 80 | return opt 81 | 82 | 83 | # -------------------------------------------------------------------- 84 | 85 | def load_tests( opt=None ): 86 | '''Load the test suite by adding all python files in this directory''' 87 | 88 | if opt is None: 89 | opt = default_opts() 90 | thisdir = os.path.dirname(__file__) 91 | 92 | # Select the test(s) to run 93 | if __name__ != '__main__' or len(sys.argv) < 2 or opt.all: 94 | test_list = script_list( thisdir ) 95 | else: 96 | test_list = [ t if t.startswith('test_') else 'test_' + t 97 | for t in sys.argv[1:] ] 98 | 99 | loader = unittest.defaultTestLoader 100 | suite = unittest.TestSuite() 101 | 102 | # Add the base path of python-aiml sources 103 | sys.path.insert( 0, os.path.dirname(thisdir) ) 104 | 105 | # Add all requested unit tests 106 | if not opt.quiet: 107 | print( "\n******************************\n" ) 108 | for test in test_list: 109 | if not opt.quiet: 110 | print( "Loading unit test '" + test + "'" ) 111 | suite.addTest( loader.loadTestsFromName( 'test.' + test ) ) 112 | 113 | return suite 114 | 115 | 116 | if __name__ == '__main__': 117 | # Usage message 118 | opt = read_opts() 119 | if opt.help: 120 | print( __doc__ ) 121 | sys.exit(1) 122 | # Load the tests 123 | suite = load_tests( opt ) 124 | # Run the tests 125 | if not opt.quiet: 126 | print( "\n\nRunning test suite\n" ) 127 | try: 128 | testrunner = unittest.TextTestRunner( verbosity=opt.verbosity ) 129 | testrunner.failfast = opt.failfast 130 | testrunner.run( suite ) 131 | except KeyboardInterrupt as err: 132 | print( "Interrupted!! :", err ) 133 | sys.exit(1) 134 | -------------------------------------------------------------------------------- /test/encoding.aiml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | PATTERN WITH EÑE 7 | 8 | 9 | 10 | 11 | PATTERN WITH * 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /test/self-test.aiml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulovn/python-aiml/21c77d5e204dfdbaef315e570fdd918b852c738b/test/self-test.aiml -------------------------------------------------------------------------------- /test/test_encoding.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from __future__ import print_function 4 | import time 5 | import os.path 6 | import unittest 7 | import sys 8 | 9 | from aiml import Kernel 10 | 11 | 12 | 13 | class TestEncoding( unittest.TestCase ): 14 | 15 | longMessage = True 16 | 17 | def setUp(self): 18 | self.k = Kernel() 19 | self.k.bootstrap( learnFiles='encoding.aiml', 20 | chdir=os.path.dirname(__file__) ) 21 | 22 | def tearDown(self): 23 | del self.k 24 | 25 | def _testTag(self, input_, outputList, name=None, encoding='utf-8'): 26 | """Test by feeding the Kernel 'input'. If the result 27 | matches any of the strings in 'outputList', the test passes. 28 | """ 29 | 30 | print( b"Testing <" + (name or input_).encode(encoding) + b">") 31 | response = self.k._cod.dec( self.k.respond( self.k._cod.enc(input_) ) ) 32 | self.assertIn( response, outputList, msg="input=%s"%input_ ) 33 | 34 | def test01_utf8( self ): 35 | '''Test literal pattern''' 36 | self._testTag( u'pattern with eñe', [u"pattern #1 matched!"]) 37 | 38 | def test02_utf8( self ): 39 | '''Test star pattern''' 40 | self._testTag( u'pattern with Á', [u"pattern #2 matched: Á"]) 41 | 42 | def test03_noencoding( self ): 43 | '''Test unencoded strings''' 44 | self.k.setTextEncoding( False ) 45 | self._testTag( u'pattern with eñe', [u"pattern #1 matched!"]) 46 | self._testTag( u'pattern with Á', [u"pattern #2 matched: Á"]) 47 | 48 | def test04_iso8859( self ): 49 | enc = 'iso-8859-1' 50 | self.k.setTextEncoding( enc ) 51 | self._testTag( u'pattern with Á', [u"pattern #2 matched: Á"], 52 | encoding=enc) 53 | -------------------------------------------------------------------------------- /test/test_kernel.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulovn/python-aiml/21c77d5e204dfdbaef315e570fdd918b852c738b/test/test_kernel.py -------------------------------------------------------------------------------- /test/test_utils.py: -------------------------------------------------------------------------------- 1 | # -*- coding: latin-1 -*- 2 | 3 | from __future__ import print_function 4 | import time 5 | import os.path 6 | import unittest 7 | 8 | from aiml import Utils 9 | 10 | 11 | class TestUtils( unittest.TestCase ): 12 | 13 | longMessage = True 14 | 15 | def setUp(self): 16 | pass 17 | 18 | def tearDown(self): 19 | pass 20 | 21 | def test_sentences( self ): 22 | sents = Utils.sentences("First. Second, still? Third and Final! Well, not really") 23 | self.assertEqual( 4, len(sents) ) 24 | 25 | -------------------------------------------------------------------------------- /test/test_wordsub.py: -------------------------------------------------------------------------------- 1 | # -*- coding: latin-1 -*- 2 | 3 | from __future__ import print_function 4 | import unittest 5 | 6 | from aiml.WordSub import WordSub 7 | 8 | 9 | class TestWordSub( unittest.TestCase ): 10 | 11 | longMessage = True 12 | 13 | def setUp(self): 14 | self.subber = WordSub() 15 | self.subber["apple"] = "banana" 16 | self.subber["orange"] = "pear" 17 | self.subber["banana" ] = "apple" 18 | self.subber["he"] = "she" 19 | self.subber["I'd"] = "I would" 20 | 21 | def tearDown(self): 22 | del self.subber 23 | 24 | def test01_sub( self ): 25 | '''test wordsub''' 26 | inStr = "He said he'd like to go with me" 27 | outStr = "She said she'd like to go with me" 28 | self.assertEqual( outStr, self.subber.sub(inStr) ) 29 | 30 | def test02_case( self ): 31 | '''test case insensitivity''' 32 | inStr = "I'd like one apple, one Orange and one BANANA." 33 | outStr = "I Would like one banana, one Pear and one APPLE." 34 | self.assertEqual( outStr, self.subber.sub(inStr) ) 35 | 36 | --------------------------------------------------------------------------------