예제 #1
0
	def __init__(self, tagsets, model_dir, ratio_thres = 0.8, max_num = 2, \
				slot_prob_thres = 0.6, value_prob_thres = 0.8, \
				mode = 'hr', bs_mode = 'enhance', bs_alpha = 0.0, \
				unified_thres = 0.5):
		self.tagsets = tagsets
		self.frame = {}
		self.memory = {}
		self.beliefstate = BeliefState(bs_mode, bs_alpha)

		self.slot_prob_threshold = slot_prob_thres
		self.value_prob_threshold = value_prob_thres
		self.ratio_thres = ratio_thres

		self.unified_thres = unified_thres
		self.slot_prob_factor = math.log(self.unified_thres, self.slot_prob_threshold)
		self.value_prob_factor = math.log(self.unified_thres, self.value_prob_threshold)
		self.ratio_thres_factor = math.log(self.unified_thres, self.ratio_thres)

		self.mode = mode

		self.svc = slot_value_classifier()
		self.svc.LoadModel(model_dir)

		self.tuple_extractor = Tuple_Extractor()
		self.rules = DSTC4_rules(tagsets)
		self.appLogger = logging.getLogger(self.MY_ID)

		if not self.svc.is_set:
			self.appLogger.error('Error: Fail to load slot_value_classifier model!')
			raise Exception('Error: Fail to load slot_value_classifier model!')
		self.value_extractor = value_extractor(tagsets, ratio_thres, max_num)
예제 #2
0
	def __init__(self, tagsets, model_dir, ratio_thres = 0, max_num = 2, update_alpha = 0, slot_prob_thres = 0.5):
		self.tagsets = tagsets
		self.frame = {}
		self.memory = {}

		self.frame_prob = {}
		self.alpha = update_alpha
		self.slot_prob_threshold = slot_prob_thres
		self.ratio_thres = ratio_thres

		self.svc = slot_value_classifier()
		self.svc.LoadModel(model_dir)

		self.appLogger = logging.getLogger(self.MY_ID)

		if not self.svc.is_set:
			self.appLogger.error('Error: Fail to load slot_value_classifier model!')
			raise Exception('Error: Fail to load slot_value_classifier model!')
		self.value_extractor = value_extractor(tagsets, ratio_thres, max_num)