Esempio n. 1
0
def conversation_NLULearning():

    print("현재 프로세스의 작업 디렉토리 [%s]" % os.getcwd())
    print("부모 디렉토리로 변경[%s]" % os.chdir(os.pardir))
    print("변경후 현재 프로세스의 작업 디렉토리 [%s]" % os.getcwd())

    print(
        "intents 파일 디렉토리[%s]" %
        os.path.abspath("ArkNLU/DialogIntents/intents_conversations_kr.json"))

    input_file_name = os.path.abspath(
        "ArkNLU/DialogIntents/intents_conversations_kr.json")
    print("intents       파일 디렉토리[%s]" % input_file_name)

    input_training_data_file_name = os.path.abspath(
        "ArkNLU/NLUModel/training_data_conversations_kr")
    print("training      파일 디렉토리[%s]" % input_training_data_file_name)

    tflearn_logs_dir = os.path.abspath(
        'ArkNLU/NLUModel/conversations_tflearn_kr_logs')
    print("tflearn_logs     디렉토리[%s]" % tflearn_logs_dir)

    tflearn_model_file_name = os.path.abspath(
        'ArkNLU/NLUModel/model_conversations_kr.tflearn')
    print("tflearn_model 파일 디렉토리[%s]" % tflearn_model_file_name)

    #     intents_file, training_data_file, tflearn_logs_dir, tflearn_model_file
    learning_model_files = dict(
        intents_file=input_file_name,
        training_data_file=input_training_data_file_name,
        tflearn_logs_dir=tflearn_logs_dir,
        tflearn_model_file=tflearn_model_file_name)

    bot = ChatClient('ko-KR', learning_model_files)
    print("conversations NLULearning instance...")

    if bot.create_learning_model(show_details=True):
        print("conversations model creation success....")
    else:
        print("conversations model creation fail....")
def home_NLULearning(work_dir):

    print("현재 프로세스의 작업 디렉토리 [%s]" % os.getcwd())
    print("부모 디렉토리로 변경[%s]" % os.chdir(os.pardir))
    print("변경후 현재 프로세스의 작업 디렉토리 [%s]" % os.getcwd())

    print("intents 파일 디렉토리[%s]" % os.path.join(
        work_dir,
        "ArkChatFramework/ArkNLU/DialogIntents/intents_home_kr.json"))

    input_file_name = os.path.join(
        work_dir, "ArkChatFramework/ArkNLU/DialogIntents/intents_home_kr.json")
    print("intents       파일 디렉토리[%s]" % input_file_name)

    input_training_data_file_name = os.path.join(
        work_dir, "ArkChatFramework/ArkNLU/NLUModel/training_data_home_kr")
    print("training      파일 디렉토리[%s]" % input_training_data_file_name)

    tflearn_logs_dir = os.path.join(
        work_dir, 'ArkChatFramework/ArkNLU/NLUModel/home_tflearn_kr_logs')
    print("tflearn_logs     디렉토리[%s]" % tflearn_logs_dir)

    tflearn_model_file_name = os.path.join(
        work_dir, 'ArkChatFramework/ArkNLU/NLUModel/model_home_kr.tflearn')
    print("tflearn_model 파일 디렉토리[%s]" % tflearn_model_file_name)

    #     intents_file, training_data_file, tflearn_logs_dir, tflearn_model_file
    learning_model_files = dict(
        intents_file=input_file_name,
        training_data_file=input_training_data_file_name,
        tflearn_logs_dir=tflearn_logs_dir,
        tflearn_model_file=tflearn_model_file_name)

    bot = ChatClient('ko-KR', learning_model_files)
    print("home NLULearning instance...")

    if bot.create_learning_model(show_details=True):
        print("home model creation success....")
    else:
        print("home model creation fail....")