[alicebot-archcomm] Condition tag once again
Jonathan Roewen
alicebot-archcomm@list.alicebot.org
Sun, 14 Sep 2003 08:49:57 +1200
Hi Guys,
This has been brought up before, but it's never really been decided what the
future will be for the condition tag.
More than one interpreter have different semantics to other interpreters,
and to the specification. ProgramD supports wildcards in values, some others
probably do too. J-Alice supports attributes such as beginswith, endswith,
contains, value, exists, etc.
I really want to see at least this tag become standardised properly, as it's
an important and useful tag to use.
Since being able to validate AIML documents is important, I've realised that
J-Alice's approach certainly isn't useful.
I don't really like having to use wildcard expressions in the value
attribute either, but that's just my view ;-) However, it's the only proper
way to write a condition for something exists or not in ProgramD and a great
deal other interpreters as <li value=""/> isn't really valid, as an
attribute must have a value (or am I mistaken?).
The other problem with the wildcard approach that I'm not fond of is what
happens if the value is something like "h*", where the * isn't separated by
spaces?
I'd still like to be able to specify things like beginswith, endswith, etc,
but I also don't want to break existing AIML with unnecessary changes.
My proposal is for list items that take a value attribute to allow an extra
optional attribute, type (or perhaps method is a better name), which is an
enumeration of valid methods of matching the value attribute to the
predicate.
Such as: <li value="..." type="...."/> or <li value='....' method='....'/>
I'm not sure which would be a better name to use for the attribute. This
would also apply for <li name='...' value='....' type='....'/> and
<condition name='...' value='...' type='....'>...</condition>.
If type/method is not specified, it should default to 'match', which does a
string comparison, thereby allowing current AIML to work without changes.
Other values for the enumeration I think should include: beginswith,
endswith, and contains.
It would also be appropriate to have the 'match' method to allow wildcard
matching as well. The exact definition of the matching process should be
well defined however.
Adding exists as a method would be pointless, as the content of the value
attribute can't be empty, so using current method of <li value="*"/> would
be the only way to provide such functionality.
Thoughts?
Jon =)