<commit_before>class PeopleIdentifier
  attr_accessor :params, :people

  def initialize(params)
    @params = params
  end

  def people
    @people ||= if params[:email]
                  # annoying that you can't do case insensitive queries without a regex
                  Person.where(email: /^#{params[:email]}$/i)
                elsif params[:twitter_id]
                  people_from_twitter
                else
                  people_from_name_fragment
                end
  end

  private
  def people_from_twitter
    people = Person.where(twitter_id: /^#{params[:twitter_id]}/i)
    return people if people.count > 0

    TwitterPersonService.new(params[:twitter_id]).people
  end

  def people_from_name_fragment
    Person.active.connected_to(params[:jurisdiction])
      .some_name_matches(params[:name_fragment])
  end
end<commit_msg>Only except exact matches for local db twitter_ids<commit_after>class PeopleIdentifier
  attr_accessor :params, :people

  def initialize(params)
    @params = params
  end

  def people
    @people ||= if params[:email]
                  # annoying that you can't do case insensitive queries without a regex
                  Person.where(email: /^#{params[:email]}$/i)
                elsif params[:twitter_id]
                  people_from_twitter
                else
                  people_from_name_fragment
                end
  end

  private
  def people_from_twitter
    # exact match only to return local results over twitter
    people = Person.where(twitter_id: /^#{params[:twitter_id]}$/i)
    return people if people.count > 0

    TwitterPersonService.new(params[:twitter_id]).people
  end

  def people_from_name_fragment
    Person.active.connected_to(params[:jurisdiction])
      .some_name_matches(params[:name_fragment])
  end
end
{'fraction_non_alphanumeric': 0.08075221238938053, 'fraction_numerical': 0.0011061946902654867, 'mean_word_length': 2.533203125, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2339037', 'n_tokens_mistral': 519, 'n_tokens_neox': 483, 'n_words': 123}