<commit_before>require 'colorize'

class CommandSuggestion
  attr_accessor :wordlist

  SHORT_ENOUGH = 3

  def initialize(wordlist)
    @wordlist = wordlist
  end

  def to_s
    if exists?
      "'#{command}' => #{abbreviation} #{abbreviation_available}"
    else
      "'#{command}' => " + "#{abbreviation}".green + " #{abbreviation_available}"
    end
  end

  def abbreviation
    wordlist.map{|w| CommandWord.suggested_letter(w) }.join.downcase
  end

private

  def command
    wordlist.join(" ")
  end

  def abbreviation_available
    "taken :(" if exists?
  end

  def exists?
    binary_checker.exist? || alias_checker.exist?(abbreviation)<commit_msg>simplify the code<commit_after>require 'colorize'

class CommandSuggestion
  attr_accessor :wordlist

  SHORT_ENOUGH = 3

  def initialize(wordlist)
    @wordlist = wordlist
  end

  def to_s
    if exists?
      "'#{command}' => #{abbreviation} taken :("
    else
      "'#{command}' => " + "#{abbreviation}".green
    end
  end

  def abbreviation
    wordlist.map{|w| CommandWord.suggested_letter(w) }.join.downcase
  end

private

  def command
    wordlist.join(" ")
  end

  def exists?
    binary_checker.exist? || alias_checker.exist?(abbreviation)
{'fraction_non_alphanumeric': 0.11822660098522167, 'fraction_numerical': 0.0016420361247947454, 'mean_word_length': 3.4652014652014653, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '1987625', 'n_tokens_mistral': 445, 'n_tokens_neox': 408, 'n_words': 88}