Exemplo n.º 1
0
    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_existing():
     suffix_regex = re.compile(r' \(.*\)$')
     name_index = NameIndex.read_files(
         os.path.join(DIR_PATH, 'data', '**', '*.csv'))
     for i, row in name_index.df.iterrows():
         row.true_name = re.sub(suffix_regex, '', row.true_name)
     name_index.df.drop_duplicates()
     return name_index
 def get_existing():
     suffix_regex = re.compile(r' \(.*\)$')
     name_index = NameIndex.read_files(
         os.path.join(DIR_PATH, 'data', '**', '*.csv'))
     # Add models without mod suffixes which don't exist
     for i, row in name_index.df.iterrows():
         model = re.sub(suffix_regex, '', row.true_name)
         if model != row.true_name:
             name_index.df = name_index.df.append(
                 pd.DataFrame([[row.false_name, model, row.form]],
                              columns=name_index.df.columns))
     name_index.df.drop_duplicates()
     return name_index
Exemplo n.º 4
0
    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
Exemplo n.º 5
0
 def get_existing():
     return NameIndex.read_files(os.path.join(DIR_PATH, 'data', '**', '*.csv'))