<commit_before>defmodule Anagram do

  def match(word, potential_anagrams) do
    Enum.filter potential_anagrams, &(anagram? word, &1)
  end

  defp anagram?(word, potential) do
    are_not_identical?(word, potential) && contains_all_chars?(word, potential)
  end

  defp are_not_identical?(word_a, word_b) do
    String.downcase(word_a) != String.downcase(word_b)
  end

  defp contains_all_chars?(word_a, word_b) do
    chars(word_a) == chars(word_b)
  end

  defp chars(word) do
    word
    |>
    String.downcase
    |>
    String.codepoints
    |>
    Enum.sort
  end

end
<commit_msg>[elixir] rename method<commit_after>defmodule Anagram do

  def match(word, potential_anagrams) do
    Enum.filter potential_anagrams, &(anagram? word, &1)
  end

  defp anagram?(word, potential) do
    are_not_identical?(word, potential) && contains_all_chars?(word, potential)
  end

  defp are_not_identical?(word_a, word_b) do
    String.downcase(word_a) != String.downcase(word_b)
  end

  defp contains_all_chars?(word_a, word_b) do
    normalise_to_char_list(word_a) == normalise_to_char_list(word_b)
  end

  defp normalise_to_char_list(word) do
    word
    |>
    String.downcase
    |>
    String.codepoints
    |>
    Enum.sort
  end

end

{'fraction_non_alphanumeric': 0.0998389694041868, 'fraction_numerical': 0.001610305958132045, 'mean_word_length': 3.8365758754863815, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '4594954', 'n_tokens_mistral': 478, 'n_tokens_neox': 472, 'n_words': 92}