<commit_before># Calculate the mode Pairing Challenge

# I worked on this challenge [by myself, with: ]

# I spent [] hours on this challenge.

# Complete each step below according to the challenge directions and
# include it in this file. Also make sure everything that isn't code
# is commented.



# 0. Pseudocode
#1. define method -Mode
#2. create array
#3. method takes objects, strings, or integers
#4. if all values are unique return array
#5. most frequent value(s) returned

# What is the input?
# What is the output? (i.e. What should the code return?)
# What are the steps needed to solve the problem?


# 1. Initial Solution
def mode (arrays)
  most_frequent = Hash.new(0)
  arrays.each do |i|
    most_frequent[i] += 1
  end
  mode_arrays =[]
  most_frequent.each do |k,v|
    if v ==most_frequent.values.max
      mode_arrays << k
end
end
mode_arrays.sort
end


# 3. Refactored Solution
include Enumerable
def mode (arrays)
  most_frequent = Hash.new(0)
  arrays.each {|i| most_frequent[i] += 1}
  mode_arrays = []
  most_frequent.each do |k,v|
    most_frequent_values = most_frequent.values.max
    if v == most_frequent_values
      mode_arrays << k
    end
  end
p mode_arrays.sort
end





# 4. Reflection<commit_msg>add reflection<commit_after># Calculate the mode Pairing Challenge

# I worked on this challenge with <NAME>

# I spent 3 hours on this challenge.

# Complete each step below according to the challenge directions and
# include it in this file. Also make sure everything that isn't code
# is commented.



# 0. Pseudocode
#1. define method -Mode
#2. create array
#3. method takes objects, strings, or integers
#4. if all values are unique return array
#5. most frequent value(s) returned

# What is the input?
# What is the output? (i.e. What should the code return?)
# What are the steps needed to solve the problem?


# 1. Initial Solution
def mode (arrays)
  most_frequent = Hash.new(0)
  arrays.each do |i|
    most_frequent[i] += 1
  end
  mode_arrays =[]
  most_frequent.each do |k,v|
    if v ==most_frequent.values.max
      mode_arrays << k
end
end
mode_arrays.sort
end


# 3. Refactored Solution
include Enumerable
def mode (arrays)
  most_frequent = Hash.new(0)
  arrays.each {|i| most_frequent[i] += 1}
  mode_arrays = []
  most_frequent.each do |k,v|
    most_frequent_values = most_frequent.values.max
    if v == most_frequent_values
      mode_arrays << k
    end
  end
p mode_arrays.sort
end





# 4. Reflection
#Which data structure did you and your pair decide to implement and why?
  #
#Were you more successful breaking this problem down into implementable pseudocode than the last with a pair?
  #Not really. We understood what we wanted to happenbut did not really know good ways to make it happen so in the sense of understanding the problem better yes that was good but in the sense of psuedocode that could help us move forward in our actual code I dont think it really helped.
#What issues/successes did you run into when translating your pseudocode to code?
  #We had to start all the way over. At first we were using a hash and we had goteen it to the point where the values listed the frequency and we needed to return the key. We tried a ton of different methods before switching to using counter instead.
#What methods did you use to iterate through the content? Did you find any good ones when you were refactoring? Were they difficult to implement?
  #We used counter at the end. I think counter was probably the easiest. The other methods we used were fairly difficult.
{'fraction_non_alphanumeric': 0.06751412429378531, 'fraction_numerical': 0.007627118644067797, 'mean_word_length': 3.677675033025099, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 4, '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': '6422265', 'n_tokens_mistral': 1121, 'n_tokens_neox': 1039, 'n_words': 501}