コード例 #1
0
ファイル: interact.py プロジェクト: igoingdown/KB-InfoBot
# db_inc_path = datadir + '/incomplete_db_%.2f.txt' %params['unk']
# dict_path = datadir + '/dicts.json'
# slot_path = datadir + '/slot_set.txt'
# corpus_path = './data/corpora/' + params['dataset'] + '_corpus.txt'
slot_path = datadir + '/slot_set_chinese.txt'
db_full_path = datadir + '/chinese_db.txt'
db_inc_path = datadir + '/incomplete_chinese_db_%.2f.txt' % params['unk']
dict_path = datadir + '/chinese_dicts.json'
corpus_path = './data/corpora/' + params['dataset'] + '_chinese_corpus.txt'

from deep_dialog.dialog_system import DialogManager, MovieDict, DictReader, Database
from deep_dialog.agents import AgentActRule, AgentNLRuleSoft, AgentNLRuleHard, AgentNLRuleNoDB, AgentSimpleRLAllAct, AgentSimpleRLAllActHardDB, AgentSimpleRLAllActNoDB, AgentE2ERLAllAct
from deep_dialog.usersims import CmdUser
from deep_dialog.objects import SlotReader

act_set = DictReader()
act_set.load_dict_from_file(params['act_set'])

slot_set = SlotReader(slot_path)

movie_kb = MovieDict(dict_path)

db_full = Database(db_full_path, movie_kb, name=params['dataset'])
db_inc = Database(db_inc_path,
                  movie_kb,
                  name='incomplete%.2f_' % params['unk'] + params['dataset'])

user_sim = CmdUser(movie_kb,
                   act_set,
                   slot_set,
                   None,
コード例 #2
0
ファイル: sim.py プロジェクト: SoluMilken/KB-InfoBot
datadir = './data/' + params['dataset']
db_full_path = datadir + '/db.txt'
db_inc_path = datadir + '/incomplete_db_%.2f.txt' %params['unk']
dict_path = datadir + '/dicts.json'
slot_path = datadir + '/slot_set.txt'
corpus_path = './data/corpora/' + params['dataset'] + '_corpus.txt'

from deep_dialog.dialog_system import DialogManager, MovieDict, DictReader, Database
from deep_dialog.agents import AgentNLRuleSoft, AgentNLRuleHard, AgentNLRuleNoDB
from deep_dialog.agents import AgentSimpleRLAllAct, AgentSimpleRLAllActHardDB
from deep_dialog.agents import AgentSimpleRLAllActNoDB, AgentE2ERLAllAct
from deep_dialog.usersims import RuleSimulator, TemplateNLG, S2SNLG
from deep_dialog.objects import SlotReader

act_set = DictReader()
act_set.load_dict_from_file(params['act_set'])

slot_set = SlotReader(slot_path)

movie_kb = MovieDict(dict_path)

db_full = Database(db_full_path, movie_kb, name=params['dataset'])
db_inc = Database(db_inc_path, movie_kb, name='incomplete%.2f_'%params['unk']+params['dataset'])

nlg = S2SNLG(template_path, params['nlg_slots_path'], params['nlg_model_path'], params['nlg_temp'])
user_sim = RuleSimulator(movie_kb, act_set, slot_set, None, max_turn, nlg, err_prob, db_full, \
        1.-dk_prob, sub_prob=params['sub_prob'], max_first_turn=params['max_first_turn'])

if params['model_name']=='pretrained':
    params['model_name'] = 'best_'+agent_type+'_imdb.m'