#!/usr/bin/python
# -*- coding: utf-8 -*-
from EmeraldAI.Logic.Singleton import Singleton
from EmeraldAI.Config.Config import *
from EmeraldAI.Entities.User import User
from EmeraldAI.Logic.Trainer.DialogTrainer import *


class Trainer(object):
    __metaclass__ = Singleton


    def __init__(self):
        self.__trainData = Config().GetBoolean("Trainer", "Enabled") # True

    def Process(self, PipelineArgs):
    	if not self.__trainData or not PipelineArgs.TrainConversation:
    		return False

    	if len(PipelineArgs.History) == 0
    		return False

    	DialogTrainer().TrainSentence(PipelineArgs.History[-1].Response, PipelineArgs.Normalized, PipelineArgs.Language, User().Name):

    	# TODO

    	return True



@@ -214,16 +214,63 @@
 mport *%0A
+from EmeraldAI.Entities.Context import Context%0A
 %0A%0Aclass 
@@ -556,28 +556,25 @@
 %09if len(
-PipelineArgs
+Context()
 .History
@@ -579,16 +579,17 @@
 ry) == 0
+:
 %0A    %09%09r
@@ -636,28 +636,25 @@
 entence(
-PipelineArgs
+Context()
 .History
@@ -732,22 +732,8 @@
 ame)
-:%0A%0A    %09# TODO
 %0A%0A  

update trainerFix Trainer issue