0

AIML を pip 経由でインストールし、ファイルstartup.pystd-startup.xmlbasic.aiml、およびbot_brain.brnコアフォルダーに書き込みました。startup.pyを実行しようとすると、次の警告が表示されます。

Loading std-startup.xml... done (0.06 seconds)
WARNING: No match found for input: load aiml b

Kernel bootstrap completed in 0.10 seconds
Saving brain to core/bot_brain.brn... done (0.00 seconds)

これはstd-startup.xmlの内容です:

<aiml version="1.0.1" encoding="UTF-8">
    <!-- std-startup.xml -->

    <category>
        <pattern>load aiml b</pattern>
        <template>
            <learn>basic.aiml</learn>
        </template>
    </category>

</aiml>

これは Python スクリプトです。

import aiml
import os

kernel = aiml.Kernel()

if os.path.isfile("core/bot_brain.brn"):
    kernel.bootstrap(brainFile = "core/bot_brain.brn")
else:
    kernel.bootstrap(learnFiles = "std-startup.xml", commands = "load aiml b")
    kernel.saveBrain("core/bot_brain.brn")

while True:
    msg = raw_input(">")
    if msg == "exit":
        exit(0)
    elif msg == "save":
        kernel.saveBrain("core/bot_brain.brn")
    else:
        bot_response = kernel.respond(msg)
        print("bot: " + bot_response)

入力ごとにエラーが発生しますNo match found for input。私が間違っていることは何ですか?bot_brain.brnを除いて、すべてが同じディレクトリにあります。

4

1 に答える 1

1

問題は解決しました。大文字で入力する必要がありました:

<category>
    <pattern>LOAD AIML B</pattern>
    <template>
        <learn>basic.aiml</learn>
    </template>
</category>
于 2016-07-06T13:23:47.303 に答える