[Python] AIML chatbot not learning from aiml file

Discussão em 'Python' iniciado por Stack, Agosto 7, 2025.

  1. Stack

    Stack Membro Participativo

    I am making a voice-assistant for food ordering in fast-food restaurants. For dialog management tasks I am making aiml chatbot. This is my std-startup.xml code '''

    <!-- Category is an atomic AIML unit -->
    <category>

    <!-- Pattern to match in user input -->
    <!-- If user enters "LOAD AIML B" -->
    <pattern>LOAD AIML B</pattern>

    <!-- Template is the response to the pattern -->
    <!-- This learn an aiml file -->
    <template>
    <learn>output.aiml</learn>
    <!-- You can add more aiml files here -->
    <!--<learn>more_aiml.aiml</learn>-->
    </template>

    </category>


    BELOW IS MAIN.PY CODE

    import aiml import os

    kernel = aiml.Kernel()

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

    kernel now ready for use


    while True: print (kernel.respond(input("Enter your message >> "))) '''

    After entering a msg which is from output.aiml itself the bot says the msg does not exists [​IMG]

    PLease can someone tell how to fix it. The bot should generate a response as given in output.aiml file

    Here is another example with category [​IMG]

    and here is bot's repsonse [​IMG]

    Continue reading...

Compartilhe esta Página