def _load_items(self): lines = load_list_from_file(self.filename) for line in lines: space_ind = line.index(' ') word = line[:space_ind] phonemes = line[space_ind + 1:].split() self._items[word] = phonemes
def build_phonemes_from_text(self, filename: str): text_lines = load_list_from_file(filename) overall_words = [] for line in text_lines: line = clean_punctuation(line) overall_words.extend(line.split()) for word in overall_words: self._build_phonemes_from_word(word)
def _load_scenarios(self): lines = load_list_from_file(self.filename) for line in lines: line = line.strip() if not line: continue # colon_ind = line.index(':') # index = int(line[:colon_ind]) # content = line[colon_ind + 1:].strip() if not line.startswith(SCENARIO_PREFIX): continue scenario_name = line[3:].strip() scenario_class_name = f'Scenario{scenario_name}' module_name = f'lang.scenarios.scenario_{scenario_name.lower()}' scenario_class = getattr(importlib.import_module(module_name), scenario_class_name) scenario = scenario_class(self) self._scenarios.append(scenario)
def _load_items(self): lines = load_list_from_file(self.filename) episode_counter = 0 for line in lines: line = line.strip() if not line: continue if line.startswith(comment_sign): continue # colon_ind = line.index(':') # index = int(line[:colon_ind]) # content = line[colon_ind + 1:].strip() if line.startswith(SCENARIO_PREFIX): continue index = episode_counter * HyperParameters.episode_length if episode_counter > 0 else 1 episode_counter += 1 self._items[index] = AssemblySource(line) self.scenario_length = episode_counter * HyperParameters.episode_length
def load(self): lines = load_list_from_file(self.filename)
def build_structure(self): text_lines = load_list_from_file( self.agent.config.get('phonetics_path')) overall_words = []