Extended AIML

From Jason Shankel's Wiki
Jump to: navigation, search
Line 78: Line 78:
  
 
So now, "MARY" can be matched in "MARY IS VISITING JOHN" with both <star index="1"/> and <star name="visitor/>
 
So now, "MARY" can be matched in "MARY IS VISITING JOHN" with both <star index="1"/> and <star name="visitor/>
 +
 +
I also added a new category of wildcard, '@' which behaves just like '*' but does NOT receive an index.  This is useful for keeping indices the same in multi-pattern categories if you have any wildcards that are ignored in the template section.
  
 
====Regular Expressions====
 
====Regular Expressions====
 +
 +
Another limitation of AIML wildcards is matching criteria. A wildcard matches any input.  It can contain spaces, numerals or anything and you have no way within AIML of limiting matches or even checking for particular criteria.
 +
 +
I extended the AIML wildcard system to support regular expressions within a bracket operator thusly:
 +
 +
"I LIKE *[[A-Z]+]"
 +
 +
In this case, the "I LIKE..." pattern is limited to matching single words containing letters but no numbers.  So "I LIKE RUNNING" would match, but not "I LIKE R2D2" or "I LIKE EATING CHICKEN."
 +
 +
Regular expressions can be used in conjunction with named wildcards thusly:
 +
 +
"I LIKE *[[A-Z]+]:what_i_like"
 +
 +
In this case "I LIKE CHICKEN" would have have <star name="what_i_like/> set to "CHICKEN" in the template section.

Revision as of 20:58, 4 April 2012

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox