keiffster / program-y

Python 3.x based AIML 2.0 Chatbot interpreter, framework, related programs and knowledge files
https://keiffster.github.io/program-y/
Other
348 stars 138 forks source link

learnf aiml file not creating windows #183

Closed poovarasanvasudevan closed 5 years ago

poovarasanvasudevan commented 5 years ago

I am using Y bot, in windows 10 , Problem i am facing is

HUMAN > My name is xxx BOT > xxx nice name HUMAN > what is my name BOT > xxx

the bot replies and remembers xxx , When i restart the server HUMAN > what is my name BOT > I've no idea.

How can i Persist the response , so that bot will learn based on the conversation with the user earlier , on start, I heared about and , I modified my config.yaml to this

  # Overrides
    overrides:
      allow_system_aiml: true
      allow_learn_aiml: true
      allow_learnf_aiml: true

    # Defaults
    defaults:
      default-get: unknown
      default-property: unknown
      default-map: unknown
      learn-filename: storage/conn/y-bot-learnf.aiml

The Problem is on Conversation it was not creating learn file

Context (Environment)

keiffster commented 5 years ago

Is the leanf file being created or not picked up on restart ?

poovarasanvasudevan commented 5 years ago

It is not created,

One thing i noticed is in conversation.convo file when we chat it maintains properties

"properties": {
        "topic": "SERVICE",
        "positivity": "0.0",
        "subjectivity": "0.5",
        "category": "AD",
        "mcontext": "ASKQ",
        "active": "true",
        "dayphase": "Night",
        "name": "poovarasan"
    }

when i restart the server all properties are gone, this is my config.yaml file config.yaml.txt

keiffster commented 5 years ago

I've just added a new test grammar to y-bot which allows me to test learnf in live and its all appears to be working. File is created and when I restart the server it picks it up again.

Have you checked the log file for any errors in file creation?

If you could stop your server, delete your log file, and then restart and only ask the question which creates the learnf file I can try and debug it for you

Would be useful to also send me the AIML that you are iusing to create the learnf file too.

poovarasanvasudevan commented 5 years ago

Hi, Thanks for the response , Now i able to create learnf file, but now, it was not picked by the bot

Scenario :

My name is xxxxx OK, I will remember your name is xxxxx what is my name YOUR NAME IS xxxxx

Now i restarted the server

what is my name I`ve no idea

AIML file i am using

test.aiml.txt

Created Learnf file poovarasan.aiml.txt

My config config.yaml.txt

Thanks

keiffster commented 5 years ago

You are creating a duplicate grammar when your learnf file is created, it clashes with

WHAT IS MY NAME which already exists in storage/categories/core/defaults/profile/client_profile.aiml (see line 35 ) You will probably find that a duplication error has been written to duplicates.txt file on start up
keiffster commented 5 years ago

Did this solve your issue ?

poovarasanvasudevan commented 5 years ago

Actually Not, May be, aiml is for Global Bot, Not for Specific user, As per my context, For each user bot has to reply their context aiml

Current Working

user A >> My name is A BOT >> OK, I will remember your name is A user A >> what is my name BOT >> YOUR NAME IS A

it created A.aiml file Now user B comes

user B >> what is my name BOT >> YOUR NAME IS A

I can`t able to store aiml on user specific, but anyway i achieved through custom service

Created a service

from programy.services.service import Service
from programy.utils.logging.ylogger import YLogger
import json

class ClientService(Service):

    def __init__(self, config=None, api=None):
        Service.__init__(self, config)

    def ask_question(self, client_context, question: str):
        ` using client_context.userid fetch user from database `
        return "Your name is " + client_context.userid

another thing i want to ask is is i able to set user properties from my custom services

Thanks Poovarasan Vasudevan

poovarasanvasudevan commented 5 years ago

Closing this, Achived Different way,

Thanks Poovarasan Vasudevan