How does aiml really work
Most basically, pattern matching such as AIML is a form of search. (Search is generally considered to be a form of Information Retrieval.) AIML pattern matching is based on Markup Language. The actual markup language or tags may be considered a kind of Metadata, or “data about data”. Pattern matching does not have to be based on markup language or metadata. Ngrams or Skipgrams (aka “concgrams”) may be used as defacto patterns.
Once identified, patterns do not have to be used with (or only with) pattern matching. Patterns may also be used with a variety of statistical ranking methods. Not only that, but question/answer chat logs resulting from pattern matching systems (like AIML) may be used as a training set for machine learning.
To the best of my understanding, an AIML interpreter functions as a rule engine - to interpret the markup language based on the rules contained in the various AIML specifications. Statistical pattern ranking would be an additional interpretation method, and machine learning would be a third avenue to arrive at (appropriate) responses or replies.