Ejemplo n.º 1
0
"""
    This file contains the main ManagementModule class which is responsible
    for automation training and also data analytics features.
"""
from database.DataBaseManager import DataBaseManager
from conf.Logger import Logger
from query_module.train import QueryModuleTrainer
import os
import datetime
from collections import Counter, defaultdict
"""
    Logger setup
"""
logger = Logger(__name__).log
"""
    Path setup
"""
PATH = os.path.dirname(os.path.realpath(__file__))
INTENT_PATH = os.path.join(PATH, '../query_module/training_data/intents/')
ENTITY_PATH = os.path.join(PATH, '../query_module/training_data/entities/')


class ManagementModule:
    def __init__(self,
                 database_manager=DataBaseManager(),
                 trainer=QueryModuleTrainer()):
        """Initialise the Management Module class with a database instance and also Query
        Trainer instance. The given instances will be the main instance that is responsible
        for the core features in this module.
        """
        self.database_manager = database_manager
Ejemplo n.º 2
0
database_manager = DataBaseManager()
query_module = QueryModule()
search_module = SearchModule(database_manager=database_manager)
management_module = ManagementModule(database_manager=database_manager)
authenticator = Authenticator(database_manager=database_manager)
"""
    Logger configurations. By default all are set to DEBUG level.
    Change the level in setLevel to suit whatever your needs are.
    Available levels from highest severity to lowest are:
        CRITICAL
        ERROR
        WARNING
        INFO
        DEBUG
"""
logger = Logger(__name__).log
logger.setLevel(logging.INFO)
query_module_logger = logging.getLogger('query_module.QueryModule')
query_module_logger.setLevel(logging.INFO)
train_logger = logging.getLogger('query_module.train')
train_logger.setLevel(logging.INFO)
search_module_logger = logging.getLogger('search_module.SearchModule')
search_module_logger.setLevel(logging.INFO)
database_logger = logging.getLogger('database.DataBaseManager')
database_logger.setLevel(logging.INFO)
management_logger = logging.getLogger('management_module.ManagementModule')
management_logger.setLevel(logging.INFO)
authentication_db_logger = logging.getLogger('authentication.db')
authentication_db_logger.setLevel(logging.DEBUG)
authentication_security_logger = logging.getLogger('authentication.security')
authentication_security_logger.setLevel(logging.DEBUG)