<commit_before>require 'set'

module NamesManager

  # Returns a set with all (canonical) contributor names known by the application.
  def self.all_names
    Set.new(Contributor.connection.select_values("SELECT name FROM contributors"))
  end

  # Determines whether names mapping or special cases handling have been updated
  # since +ts+.
  def self.mapping_updated_since?(ts)
    File.mtime(__FILE__) > ts
  end

  # Simple trick to be able to publish this file with readable addresses.
  def self.e(user, domain)
    user + '@' + domain
  end

  # canonical name => handlers, emails, typos, etc.
  SEEN_ALSO_AS = {}
  def self.map(canonical_name, *also_as)
    SEEN_ALSO_AS[canonical_name] = also_as
  end

  # Some people appear in Rails logs under different names, there are nicks,
  # typos, email addresses, shortenings, etc. This is a hand-made list to map
  # them in order to be able to aggregate commits from the same real author.
  #
  # This mapping does not use regexps on purpose, it is more robust to put the
  # exact string equivalences. The manager has to be very strict about this.
  map '<NAME>',               e('adam', 'the-kramers.net')
  map 'alancfrancis',              e('alancfrancis', 'gmail.com')
  map '<NAME>',            'adymo'
  map '<NAME>',     '<NAME>'
  map '<NAME>',            e('akaspick', 'gmail.com'), 'akaspick', e('andrew', 'redlinesoftware.com')
  map '<NAME>',              'pixeltrix'
  map '<NAME>',              'aeden'
  map '<NAME>',             'sandofsky'
  map '<NAME>',              'bscofield'
  map 'Blaine',                    'blaine', e('blaine', 'odeo.com')
  map '<NAME>',               e('brad.ediger', 'madriska.com'), e('brad', 'madriska.com'), 'bradediger'
  map '<NAME>',                e('bellis', 'deepthought.org')
  map '<NAME>',                 'BobSilva'
  map '<NAME>',             'bgreenlee'
  map '<NAME>',           'brandon', e('brandon', 'opensoul.org')
  map '<NAME>',             'eventualbuddha'
  map '<NAME>',              e('caleb', 'aei-tech.com')
  map '<NAME>',            '<NAME>', 'chuyeow'
  map '<NAME>',           'kampers'
  map '<NAME>',             e('c.r.mcgrath', 'gmail.com'), 'c.r.mcgrath', e('chris', 'octopod.info'), 'octopod'
  map '<NAME>',                e('chris', 'feedmechocolate.com'), 'chrismear'
  map "<NAME>",          'thechrisoshow'
  map '<NAME>',                'chrisroos'
  map '<NAME>',                 'codahale'
  map '<NAME>',               e('codyfauser', 'gmail.com')
  map '<NAME>',         'court3nay', 'courtenay', e('court3nay', 'gmail.com')
  map '<NAME>',           'djanowski'
  map '<NAME>',                  'dkubb'
  map '<NAME>',                'dcmanges'
  map '<NAME>',           'danielmorrison'
  map '<NAME>', 'drodriguez'
  map '<NAME>',                  e('dave', 'cherryville.org')
  map '<NAME>',               e('dave', 'pragprog.com'), 'pragdave'
  map '<NAME>',            'dblack'
  map '<NAME>',            'calavera', 'david.calavera'
  map '<NAME>',              'ddollar'
  map '<NAME>',  'DHH'
  map '<NAME>',              e('mortonda', 'dgrmm.net')
  map '<NAME>',               'Dee.Zsombor', 'zsombor', e('Dee.Zsombor', 'gmail.com')
  map '<NAME>',                  e('don.park', 'gmail.com')
  map '<NAME>',                    'drnic'
  map '<NAME>',             e('duane.johnson', 'gmail.com')
  map '<NAME>',            'duncanbeevers'
  map '<NAME>',             e('elijah.miller', 'gmail.com'), 'jqr'
  map '<NAME>',              e('elliot', 'townx.org')
  map '<NAME>',                'alloy'
  map '<NAME>',              'miloops'
  map '<NAME>',           'ernesto.jimenez'
  map '<NAME>',               'evan'
  map '<NAME>',       '<NAME>', '<NAME>', e('fbeausoleil', 'ftml.net'), e('francois.beausoleil', 'gmail.com')
  map '<NAME>',          'fcheung', '<NAME>', 'frederick.cheung', e('frederick.cheung', 'gmail.com')
  map '<NAME>',          'dasil003'
  map '<NAME>',             'gbuesing', '<NAME>'
  map '<NAME>',             'ggarside'
  map '<NAME>',        e('grant', 'antiflux.org')
  map '<NAME>',                  e('guy.naor', 'famundo.com')
  map '<NAME>',            e('hcatlin', 'gmail.com')
  map '<NAME>',                '<NAME>', e('henrik', 'nyh.se'), 'henrik'
  map 'Hongli Lai (Phusion)',      'FooBarWidget', 'Hongli Lai', 'Hongli Lai (Phusion'
  map '<NAME>',                 e('ian.w.white', 'gmail.com')
  map '<NAME>',               'isaacfeliu'
  map '<NAME>',         'danger', 'Danger'
  map '<NAME>',           '<NAME>', e('jakob', 'mentalized.net')
  map '<NAME>',              e('jarkko', 'jlaine.net'), 'Jarkko', 'jarkko'
  map '<NAME>',                'lazyatom', e('james.adam', 'gmail.com')
  map '<NAME>',                'floehopper'
  map '<NAME>',            'fearoffish'
  map '<NAME>',            'DefV'
  map '<NAME>',                '<NAME> (Fryguy)'
  map '<NAME>',            'jramirez'
  map '<NAME>',             'packagethief'
  map '<NAME>',               e('jeremyevans0', 'gmail.com'), 'jeremyevans'
  map '<NAME>',              'bitsweat'
  map '<NAME>',            'jeremymcnally', 'jeremymcanally'
  map '<NAME>',             e('jeremy', 'planetargon.com')
  map '<NAME>',             '<NAME>', '<NAME>'
  map '<NAME>',              'jbarnette'
  map '<NAME>',                   e('jon', 'instance-design.co.uk')
  map '<NAME>',      'Catfish', 'catfish'
  map '<NAME>',             e('jonathan', 'bluewire.net.nz')
  map '<NAME>',             'jweiss'
  map '<NAME>',              'jordi'
  map '<NAME>',                 'josevalim'
  map '<NAME>',                'Dreamer3', e('dreamer3', 'gmail.com')
  map '<NAME>',               e('joshknowles', 'gmail.com')
  map '<NAME>',                  'josh', 'Josh', '<NAME>', 'joshpeek', e('josh', 'joshpeek.com')
  map '<NAME>',              e('josh.starcher', 'gmail.com')
  map '<NAME>',                'hasmanyjosh', e('josh', 'hasmanythrough.com')
  map '<NAME>',             'jsierles'
  map '<NAME>',               'juanjo.bazan'
  map '<NAME>',              'justinfrench'
  map '<NAME>',      'kamal'
  map '<NAME>',               e('kajism', 'yahoo.com')
  map '<NAME>',                 e('ken.barker', 'gmail.com')
  map '<NAME>',                   e('kennethkunz', 'gmail.com')
  map '<NAME>',                 e('kenneth.miller', 'bitfield.net')
  map '<NAME>',                "<NAME> #{e('kevin.clark', 'gmail.com')}", e('kevin.clark', 'gmail.com'), e('kevin.clark', 'gmal.com')
  map '<NAME>',              e('foamdino', 'gmail.com')
  map '<NAME>',         e('murphy', 'cYcnus.de')
  map '<NAME>',        e('kristopher.chambers', 'gmail.com'), 'kris_chambers'
  map '<NAME>',                  e('lars', 'pinds.com'), e('lars', 'pind.com'), 'Lars pind', 'lars pind'
  map '<NAME>',               'lawrence'
  map '<NAME>',                 'lmarlow', e('lmarlow', 'yahoo.com')
  map '<NAME>',                '<NAME>'
  map '<NAME>',                 'l.guidi'
  map '<NAME>',             'cavalle', 'cavelle'
  map '<NAME>',               e('contact', 'lukeredpath.co.uk')
  map 'maiha',                      'anna', e('anna', 'wota.jp'), e('maiha', 'wota.jp')<commit_msg>adds equivalence for Jon Bright<commit_after>require 'set'

module NamesManager

  # Returns a set with all (canonical) contributor names known by the application.
  def self.all_names
    Set.new(Contributor.connection.select_values("SELECT name FROM contributors"))
  end

  # Determines whether names mapping or special cases handling have been updated
  # since +ts+.
  def self.mapping_updated_since?(ts)
    File.mtime(__FILE__) > ts
  end

  # Simple trick to be able to publish this file with readable addresses.
  def self.e(user, domain)
    user + '@' + domain
  end

  # canonical name => handlers, emails, typos, etc.
  SEEN_ALSO_AS = {}
  def self.map(canonical_name, *also_as)
    SEEN_ALSO_AS[canonical_name] = also_as
  end

  # Some people appear in Rails logs under different names, there are nicks,
  # typos, email addresses, shortenings, etc. This is a hand-made list to map
  # them in order to be able to aggregate commits from the same real author.
  #
  # This mapping does not use regexps on purpose, it is more robust to put the
  # exact string equivalences. The manager has to be very strict about this.
  map '<NAME>',               e('adam', 'the-kramers.net')
  map 'alancfrancis',              e('alancfrancis', 'gmail.com')
  map '<NAME>',            'adymo'
  map '<NAME>',     '<NAME>'
  map '<NAME>',            e('akaspick', 'gmail.com'), 'akaspick', e('andrew', 'redlinesoftware.com')
  map '<NAME>',              'pixeltrix'
  map '<NAME>',              'aeden'
  map '<NAME>',             'sandofsky'
  map '<NAME>',              'bscofield'
  map 'Blaine',                    'blaine', e('blaine', 'odeo.com')
  map '<NAME>',               e('brad.ediger', 'madriska.com'), e('brad', 'madriska.com'), 'bradediger'
  map '<NAME>',                e('bellis', 'deepthought.org')
  map '<NAME>',                 'BobSilva'
  map '<NAME>',             'bgreenlee'
  map '<NAME>',           'brandon', e('brandon', 'opensoul.org')
  map '<NAME>',             'eventualbuddha'
  map '<NAME>',              e('caleb', 'aei-tech.com')
  map '<NAME>',            '<NAME>', 'chuyeow'
  map '<NAME>',           'kampers'
  map '<NAME>',             e('c.r.mcgrath', 'gmail.com'), 'c.r.mcgrath', e('chris', 'octopod.info'), 'octopod'
  map '<NAME>',                e('chris', 'feedmechocolate.com'), 'chrismear'
  map "<NAME>",          'thechrisoshow'
  map '<NAME>',                'chrisroos'
  map '<NAME>',                 'codahale'
  map '<NAME>',               e('codyfauser', 'gmail.com')
  map '<NAME>',         'court3nay', 'courtenay', e('court3nay', 'gmail.com')
  map '<NAME>',           'djanowski'
  map '<NAME>',                  'dkubb'
  map '<NAME>',                'dcmanges'
  map '<NAME>',           'danielmorrison'
  map '<NAME>', 'drodriguez'
  map '<NAME>',                  e('dave', 'cherryville.org')
  map '<NAME>',               e('dave', 'pragprog.com'), 'pragdave'
  map '<NAME>',            'dblack'
  map '<NAME>',            'calavera', 'david.calavera'
  map '<NAME>',              'ddollar'
  map '<NAME>',  'DHH'
  map '<NAME>',              e('mortonda', 'dgrmm.net')
  map '<NAME>',               'Dee.Zsombor', 'zsombor', e('Dee.Zsombor', 'gmail.com')
  map '<NAME>',                  e('don.park', 'gmail.com')
  map '<NAME>',                    'drnic'
  map '<NAME>',             e('duane.johnson', 'gmail.com')
  map '<NAME>',            'duncanbeevers'
  map '<NAME>',             e('elijah.miller', 'gmail.com'), 'jqr'
  map '<NAME>',              e('elliot', 'townx.org')
  map '<NAME>',                'alloy'
  map '<NAME>',              'miloops'
  map '<NAME>',           'ernesto.jimenez'
  map '<NAME>',               'evan'
  map '<NAME>',       'FranÃ§<NAME>', '<NAME>', e('fbeausoleil', 'ftml.net'), e('francois.beausoleil', 'gmail.com')
  map '<NAME>',          'fcheung', '<NAME>', 'frederick.cheung', e('frederick.cheung', 'gmail.com')
  map '<NAME>',          'dasil003'
  map '<NAME>',             'gbuesing', '<NAME>'
  map '<NAME>',             'ggarside'
  map '<NAME>',        e('grant', 'antiflux.org')
  map '<NAME>',                  e('guy.naor', 'famundo.com')
  map '<NAME>',            e('hcatlin', 'gmail.com')
  map '<NAME>',                '<NAME>', e('henrik', 'nyh.se'), 'henrik'
  map '<NAME> (Phusion)',      'FooBarWidget', 'Hongli Lai', 'Hongli Lai (Phusion'
  map '<NAME>',                 e('ian.w.white', 'gmail.com')
  map '<NAME>',               'isaacfeliu'
  map '<NAME>',         'danger', 'Danger'
  map '<NAME>',           '<NAME>', e('jakob', 'mentalized.net')
  map '<NAME>',              e('jarkko', 'jlaine.net'), 'Jarkko', 'jarkko'
  map '<NAME>',                'lazyatom', e('james.adam', 'gmail.com')
  map '<NAME>',                'floehopper'
  map '<NAME>',            'fearoffish'
  map '<NAME>',            'DefV'
  map '<NAME>',                '<NAME> (Fryguy)'
  map '<NAME>',            'jramirez'
  map '<NAME>',             'packagethief'
  map '<NAME>',               e('jeremyevans0', 'gmail.com'), 'jeremyevans'
  map '<NAME>',              'bitsweat'
  map '<NAME>',            'jeremymcnally', 'jeremymcanally'
  map '<NAME>',             e('jeremy', 'planetargon.com')
  map '<NAME>',             '<NAME>', '<NAME>'
  map '<NAME>',              'jbarnette'
  map '<NAME>',                 e('jon', 'siliconcircus.com')
  map '<NAME>',                   e('jon', 'instance-design.co.uk')
  map '<NAME>',      'Catfish', 'catfish'
  map '<NAME>',             e('jonathan', 'bluewire.net.nz')
  map '<NAME>',             'jweiss'
  map '<NAME>',              'jordi'
  map '<NAME>',                 'josevalim'
  map '<NAME>',                'Dreamer3', e('dreamer3', 'gmail.com')
  map '<NAME>',               e('joshknowles', 'gmail.com')
  map '<NAME>',                  'josh', 'Josh', '<NAME>', 'joshpeek', e('josh', 'joshpeek.com')
  map '<NAME>',              e('josh.starcher', 'gmail.com')
  map '<NAME>',                'hasmanyjosh', e('josh', 'hasmanythrough.com')
  map '<NAME>',             'jsierles'
  map '<NAME>',               'juanjo.bazan'
  map '<NAME>',              'justinfrench'
  map '<NAME>',      'kamal'
  map '<NAME>',               e('kajism', 'yahoo.com')
  map '<NAME>',                 e('ken.barker', 'gmail.com')
  map '<NAME>',                   e('kennethkunz', 'gmail.com')
  map '<NAME>',                 e('kenneth.miller', 'bitfield.net')
  map '<NAME>',                "<NAME> #{e('kevin.clark', 'gmail.com')}", e('kevin.clark', 'gmail.com'), e('kevin.clark', 'gmal.com')
  map '<NAME>',              e('foamdino', 'gmail.com')
  map '<NAME>',         e('murphy', 'cYcnus.de')
  map '<NAME>',        e('kristopher.chambers', 'gmail.com'), 'kris_chambers'
  map '<NAME>',                  e('lars', 'pinds.com'), e('lars', 'pind.com'), 'Lars pind', 'lars pind'
  map '<NAME>',               'lawrence'
  map '<NAME>',                 'lmarlow', e('lmarlow', 'yahoo.com')
  map '<NAME>',                '<NAME>'
  map '<NAME>',                 'l.guidi'
  map '<NAME>',             'cavalle', 'cavelle'
  map '<NAME>',               e('contact', 'lukeredpath.co.uk')
  map 'maiha',                      'anna', e('anna', 'wota.jp'), e('maiha', 'wota.jp')
{'fraction_non_alphanumeric': 0.1975, 'fraction_numerical': 0.0011111111111111111, 'mean_word_length': 2.04525269613026, 'pattern_counts': {'":': 0, '<': 241, '<?xml version=': 0, '>': 245, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7361609', 'n_tokens_mistral': 4890, 'n_tokens_neox': 4979, 'n_words': 1172}