autotyp / autotyp-data

AUTOTYP data export
Creative Commons Attribution 4.0 International
38 stars 20 forks source link

Ambiguous author/editor lists in bibliography #37

Closed xrotwang closed 2 years ago

xrotwang commented 2 years ago

To make pybtex parse the bibliography, I had to apply the following fixes, to make authot/editor lists unambiguously parseable. (pybtex complains about "too many commas" without the fixes.)

def fix_bib(s):
    n = []
    for line in s.split('\n'):
        if 'author' in line or ('editor' in line):
            line = line.replace(' / ', ' and ')
            line = line.replace(' & ', ' and ')
            line = line.replace('&', ' and ')
            line = line.replace('/', ' and ')
        n.append(line)
    s = '\n'.join(n)
    repls = {
        'Csató, Éva Ágnes, Isaksson, Bo': 'Csató, Éva Ágnes and Isaksson, Bo',
        'Aikhenvald, A., R.M.W.Dixon,': 'Aikhenvald, A. and R.M.W.Dixon,',
        'Rivai, F.S., Sorrentino, A.': 'Rivai, F.S. and Sorrentino, A.',
        'E. Ashton, E. M. K. Ostell, E. G. M. Mulira, Ndawula': 'E. Ashton, E. M. K. and Ostell, E. G. M. and Mulira, Ndawula',
        'Bickel, Balthasar, Martin Gaenszle, Arjun Rai, Prem D. Rai,  Shree K. Rai, Vishnu S. Rai, Narayan P. Sharma (Gautam)':
            'Bickel, Balthasar and Martin Gaenszle and Arjun Rai and Prem D. Rai and Shree K. Rai and Vishnu S. Rai and Narayan P. Sharma (Gautam)',
        'Zigmond, Maurice L. , Munro, Pamela': 'Zigmond, Maurice L. and Munro, Pamela',
        'Balthasar Bickel, Manoj Rai, Netra P. Paudyal, Goma Banjade, Toya N. Bhatta, Martin Gaenszle, Elena Lieven, Ichchha Purna Rai, Novel Kishore Rai,':
            'Balthasar Bickel and Manoj Rai and Netra P. Paudyal and Goma Banjade and Toya N. Bhatta and Martin Gaenszle and Elena Lieven and Ichchha Purna Rai and Novel Kishore Rai',
    }
    for k, v in repls.items():
        s = s.replace(k, v)
    return s

Maybe it would be an option to curate the AUTOTYP bibliography via the "copy" at Glottolog (https://github.com/glottolog/glottolog/blob/master/references/bibtex/autotyp.bib)?

tzakharko commented 2 years ago

Looks great, thanks for going through all that effort! The curated version has been integrated in 06e4ab411446402534ee6cd3c6abe1a311736662