I am developing a small AIML en开发者_高级运维gine, and I am having difficulty understanding what the <learn>
tag is for.
If I understand correctly, it's merely to point to an external AIML resource that can be integrated into the current ruleset?
Yes, that's correct.
See: Artificial Intelligence Markup Language 1.0.1 Spec
The learn tag reloads the specified AIML files. For example, if a developer changes some AIML files while the chatterbot is being executed, then the developer can tell the chatterbot to reload. The files will only be reloaded if you have this line:
<category>
<pattern>RELOAD AIML FILES</pattern>
<template>
Okay.
<think>
<learn>./aiml/*.aiml</learn>
</think>
</template>
</category>
The bot can be made to reload specific AIML files, all files, or a set of AIML files. The learn tag is usually placed inside of think tags.
The <learn>
tag has gone through some evolution. Originally it meant "load an AIML file". Later Pandorabots used the <learn>
tag so that the bot can be taught new categories on the fly through conversation. The <learn>
tag and its companion <learnf>
have been incorporated into the AIML 2.0 spec. See https://docs.google.com/document/d/1wNT25hJRyupcG51aO89UcQEiG-HkXRXusukADpFnDs4/pub
精彩评论