<commit_before># U2.W4: Research Methods

i_want_pets = ["I", "want", 3, "pets", "but", "only", "have", 2]
my_family_pets_ages = {"Evi" => 6, "Hoobie" => 3, "George" => 12, "Bogart" => 4, "Poly" => 4,
            "Annabelle" => 0, "Ditto" => 3}

#********************************* ARRAY FINDING METHOD *********************************

# Person 1's solution
def my_array_finding_method(source, thing_to_find)
  i = 0
  t = 0
  output_array = []
  while i < source.length
    if source[i].to_s.include?(thing_to_find)
      output_array[t] = source[i].to_s
      t += 1
    end
    i +=1
  end
  return output_array
end

#********************************* HASH FINDING METHOD *********************************
#pseudocode
#Iterates over hash for value match
#Places keys of matching values in an array
#Returns array


def my_hash_finding_method(source, thing_to_find)
  output_array = []
  i = 0
  source.each_pair { |key,value|
    if value == thing_to_find
      output_array[i] = key
      i += 1
    end
  }
  return output_array
end




# # Identify and describe the Ruby method you implemented.
# #
# #
# #<commit_msg>Added pseudocode for problem 1<commit_after># U2.W4: Research Methods

i_want_pets = ["I", "want", 3, "pets", "but", "only", "have", 2]
my_family_pets_ages = {"Evi" => 6, "Hoobie" => 3, "George" => 12, "Bogart" => 4, "Poly" => 4,
            "Annabelle" => 0, "Ditto" => 3}

#********************************* ARRAY FINDING METHOD *********************************

# Person 1's solution
#pseudocode
#Iterates through array (source argument) via indices for match to thing_to_find argument.
#If matched, assigns String from source array to new output_array.
#Returns output_array.

def my_array_finding_method(source, thing_to_find)
  i = 0
  t = 0
  output_array = []
  while i < source.length
    if source[i].to_s.include?(thing_to_find)
      output_array[t] = source[i].to_s
      t += 1
    end
    i +=1
  end
  return output_array
end

#********************************* HASH FINDING METHOD *********************************
#pseudocode
#Iterates over hash values for a match to thing_to_find argument.
#Places keys of matching values in an array.
#Returns array.


def my_hash_finding_method(source, thing_to_find)
  output_array = []
  i = 0
  source.each_pair { |key,value|
    if value == thing_to_find
      output_array[i] = key
      i += 1
    end
  }
  return output_array
end




# # Identify and describe the Ruby method you implemented.
# #
# #
# #
{'fraction_non_alphanumeric': 0.21460088247091857, 'fraction_numerical': 0.015643802647412757, 'mean_word_length': 3.861598440545809, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '5953893', 'n_tokens_mistral': 908, 'n_tokens_neox': 836, 'n_words': 243}