def init_name_proposals(self): """Gets name proposals for new measurements Returns: NameIndex """ name_proposals = NameIndex() for db in [ 'crinacle', 'oratory1990', 'rtings', 'referenceaudioanalyzer' ]: name_index = NameIndex.read_tsv( os.path.join(DIR_PATH, db, 'name_index.tsv')) name_proposals.concat(name_index) for db in ['innerfidelity', 'headphonecom']: name_index = NameIndex.read_files( os.path.join(DIR_PATH, db, 'data', '**', '*.csv')) name_proposals.concat(name_index) name_proposals.remove_duplicates() manufacturer_pattern = rf'^({"|".join([m[0] for m in self.manufacturers.manufacturers])})' proposal_data = {'form': [], 'manufacturer': [], 'model': []} for item in name_proposals.items: if not item.true_name or item.form == 'ignore': continue manufacturer = re.search(manufacturer_pattern, item.true_name, flags=re.IGNORECASE) if not manufacturer: continue manufacturer = manufacturer[0] proposal_data['form'].append(item.form) proposal_data['manufacturer'].append(manufacturer) proposal_data['model'].append( item.true_name.replace(manufacturer, '').strip()) self.name_proposals = pd.DataFrame(proposal_data)
def get_name_proposals(self): """Gets name proposals for new measurements Returns: NameIndex """ name_proposals = NameIndex() for db in ['crinacle', 'oratory1990', 'rtings', 'referenceaudioanalyzer']: name_index = NameIndex.read_tsv(os.path.join(DIR_PATH, db, 'name_index.tsv')) name_proposals.concat(name_index) for db in ['innerfidelity', 'headphonecom']: name_index = NameIndex.read_files(os.path.join(DIR_PATH, db, 'data', '**', '*.csv')) name_proposals.concat(name_index) name_proposals.remove_duplicates() return name_proposals