<file_sep>"""
Glues the intents to the chatbot user interface.
"""


class Interactions(object):
    pass<file_sep># jchatbot

This is a simple chatbot application. ( Yet another chatbot ).

Is expected to be coded in:
    * python 3.6
    * elasticsearch 5x

## 1. Getting started

Up and running:

```
[jd@jaypc jchatbot]$ python3.6 jchatbot.py
Welcome to JD's chatbot ... version 0.2 [cmdLine version]...
jchatbot > hi
Dont you know how to talk to jchatbot? :/
jchatbot > help

Documented commands (type help <topic>):
========================================
bye  hello  help

jchatbot > help hello
Greet the chatbot
jchatbot > help bye
Bbye
jchatbot > hello
Nahh I'm loading AI to mah brain! DND...
jchatbot > help

Documented commands (type help <topic>):
========================================
bye  hello  help

jchatbot > bye
Good you understand what is DND! :P
[jd@jaypc jchatbot]$
```
<file_sep>import cmd
import sys


class jchatbot(cmd.Cmd):
    """
    JDs Chat BOT
    """
    intro = "Welcome to JD's chatbot ... version 0.2 [cmdLine version]..."

    prompt = "jchatbot > "

    def do_hello(self, arg):
        'Greet the chatbot'
        print("Nahh I'm loading AI to mah brain! DND...")

    def do_bye(self, arg):
        'Bbye'
        print("Good you understand what is DND! :P")
        sys.exit(0)

    def emptyline(self):
        print("Ayeeh!.. Stop pressing enter randomly!")

    def default(self, line):
        print("Dont you know how to talk to jchatbot? :/")

    def postloop(self):
        self.say_bye()


if __name__ == "__main__":
    jchatbot().cmdloop()<file_sep>"""
This are the actions supposed to be taken by the chatbot based on
    a formally designed action statement.

    Ex. Like open google chrome browser.
     will be searched based on lucene based matching to any designed intents
     in ES like "Google Chrome Browser" -> intent [ "open" : launch a browser ]
                "Google chrome browser" -> intent [ "search" : open chrome and google search page ]

    Here intents keywords are the must keywords present in the Phrase.
"""


class Intent(object):
    """
    Intent 
        id -> keyword -> sha256sum of searchPhrase [ Custom indexing ]
        searchPhrase -> text [ full text searched with fuzziness ]
        intent_actions -> list of [ intent_keyword -> function mappings ]
                            intent_keyword = text
                            intent_keyword.keyword = keyword
                            function mappings = keyword
    """
    def __init__(self, searchPhrase='', intent_actions=None):
        """
        A searchPhrase once set cannot be changed. 
        It needs entire object to be deleted.
        
        Intent actions is a mutable list.
        """
        self.searchPhrase = searchPhrase
        self.intent_actions = intent_actions

    def exists_intent_action(self, intent_keyword):
        """
        Checks if an intent exists by keyword search
        """
        pass

    def add_intent_action(self, intent_keyword, intent_function):
        """
        Adds an intent action to the Intent
        """
        pass

    def get_intent_action(self, intent_keyword):
        """
        Exists check + return dict
        """
        pass

    def commit_intent_object(self):
        pass

    @staticmethod
    def fetch_fromDB(self, searchPhrase):
        """
        Search from db and load details to current object if any
            returns intentObject if found and loads in new object
            returns None if not found
        """
        pass



