def conversation(): with tf.Session() as sess: with tf.variable_scope("be_model") as scope: model_be = BotEngine.create_model(sess, True) print("be 모델 생성 완료") with tf.variable_scope("gg_model"): scope.reuse_variables() model_gg = GrammarGenerator.create_model(sess, True) print("gg 모델 생성 완료, 이어서 대화 시작") while True: try: query = input() print("나 : ", query) except EOFError as eofe: print("이만 테스트를 마칩니다.") break f_answer = BotEngine.decode(sess, model_be, query) print("be 모델 판단") i_answer = GrammarGenerator.decode(sess, model_gg, f_answer, False) print("gg 모델 판단") result = [] for word in i_answer: if '/' in word: result.append(word[:word.index('/')]) answer = " ".join(result) print("Com : ", answer)
def test_be(): with tf.Session() as sess: with tf.variable_scope("be_model"): model = BotEngine.create_model(sess, True) while True: try : query = input("나 : ") except EOFError as eofe: print("\n이만 테스트를 마칩니다.") break answer = BotEngine.decode(sess, model, query) result = [] for word in answer: if '/' in word: result.append(word[:word.index('/')]) #else : # result.append(word) answer = " ".join(result) print("Com : ", answer)
def get_bot_response(message): """This is just a dummy function, returning a variation of what the user said. Replace this function with one connected to chatbot.""" bot_resp = BotEngine.get_response(message) return bot_resp #"This is a dummy response to '{}'".format(message)
from selenium import webdriver import BotEngine chromedriver_path = r'PATH_TO_CHROMEDRIVE_EXECUTABLE' webdriver = webdriver.Chrome(executable_path=chromedriver_path) BotEngine.init(webdriver) BotEngine.update(webdriver) webdriver.close()
from selenium import webdriver # from selenium.webdriver.chrome.options import Options import BotEngine # options = Options() # options.headless = True # driver = webdriver.Chrome(options=options) chromedriver_path = "C:/Users/User/PycharmProjects/drivers/chromedriver_win32/chromedriver.exe" driver = webdriver.Chrome(chromedriver_path) BotEngine.init(driver) driver.close()
def train_be(): BotEngine.train()
import CLI, BotEngine, Constants CLI.main() BotEngine.update(run_mode=Constants.RUN_MODE ,developer_mode=Constants.DEVELOPER_MODE)
from selenium import webdriver import BotEngine import Constants import sys path = '' try: if sys.argv[1] == 'path': path = '../' except: pass chromedriver_path = "/Users/jmurillocordoba/Downloads/chromedriver" webdriver = webdriver.Chrome(executable_path=chromedriver_path) BotEngine.init(webdriver, path) webdriver.close()