def load(self, file_name): tp_mod = load_as_module(file_name, force=True) if not hasattr(tp_mod, 'CONDITION_TRANSL'): raise Exception( "Weather config does not define the 'CONDITION_TRANSL' object!" ) self.condition_transl = tp_mod.CONDITION_TRANSL
def load(self, file_name): db_mod = load_as_module(file_name, force=True) if not hasattr(db_mod, 'database'): raise SLUException("The category label database does not define the `database' object!") self.database = db_mod.database self.normalise_database() # Update derived data structures. self.gen_synonym_value_category() self.gen_form_value_cl_list() self.gen_mapping_form2value2cl() self._form_val_upname = None self._form_upnames_vals = None
def load(self, file_name): db_mod = load_as_module(file_name, force=True) if not hasattr(db_mod, 'database'): raise SLUException( "The category label database does not define the `database' object!" ) self.database = db_mod.database self.normalise_database() # Update derived data structures. self.gen_synonym_value_category() self.gen_form_value_cl_list() self.gen_mapping_form2value2cl() self._form_val_upname = None self._form_upnames_vals = None
def load_templates(self, file_name): """\ Load templates from an external file, which is assumed to be a Python source which defines the variable 'templates' as a dictionary containing stringified dialog acts as keys and (lists of) templates as values. """ try: templates = load_as_module(file_name, force=True).templates # normalize the templates self.templates = {} # generalised templates self.gtemplates = {} for k, v in templates.iteritems(): da = DialogueAct(k) # k.sort() self.templates[unicode(da)] = v self.gtemplates[unicode(self.get_generic_da(da))] = (da, v) except Exception as e: raise TemplateNLGException('No templates loaded from %s -- %s!' % (file_name, e))
def load(self, file_name): on_mod = load_as_module(file_name, force=True) if not hasattr(on_mod, 'ontology'): raise OntologyException( "The ontology file does not define the 'ontology' object!") self.ontology = on_mod.ontology
def load(self, file_name): on_mod = load_as_module(file_name, force=True) if not hasattr(on_mod, "ontology"): raise OntologyException("The ontology file does not define the 'ontology' object!") self.ontology = on_mod.ontology
def load(self, file_name): tp_mod = load_as_module(file_name, force=True) if not hasattr(tp_mod, 'CONDITION_TRANSL'): raise Exception("Weather config does not define the 'CONDITION_TRANSL' object!") self.condition_transl = tp_mod.CONDITION_TRANSL
def load(self, file_name): tp_mod = load_as_module(file_name, force=True) if not hasattr(tp_mod, 'substitutions'): raise TTSPreprocessingException("The TTS preprocessing file does not define the 'substitutions' object!") self.substitutions = tp_mod.substitutions