[alicebot-developer] Order of the match path components
Kim Sullivan
alicebot-developer@list.alicebot.org
Fri, 11 Nov 2005 02:42:45 +0100
> My question is, what is the rationale behind this
> ordering?
It's not storage efficiency or matching speed, it's matching behaviour. The
order is defined such that (basically) a more concrete pattern overrides a
more general pattern, but that given two equal patterns, the one with the
more concrete 'that' overrides the one with the less concrete that. If you
reverse the order, the semantics get changed too. The desired behaviour is a
lexicographic ordering of categories. Obviously, if you change the order in
which the elements are "compared", you change the resulting ordering, and
achieve different results e.g. you might sort a database first by name, and
then by score, or first by score and then by name. While the second approach
might be more efficient, it doesn't get you very far if you need an
alphabeticaly sorted list of names.
> To me it looks the inverse would be a more
> efficient option.
To attain matching efficiency, other routes have to be taken, for example,
not storing the "default" topic and 'that' (all those implied *). But, due
to the general set-up of the algorithm (and its desired behaviour), matching
will aways be exponential in the worst case.
Kim