title: Algorithm for classifying words for hangman difficulty levels as "Easy","Medium", or "Hard"
body: <p>What is a good algorithm to determine the "difficulty" of a word for a hangman game, so that the game can select words to match a specified difficulty level?</p>
  
  <p>Difficulty would seem related to the number of guesses required, the relative frequency of usage of letters (e.g. words with many uncommon letters may be harder to guess), and potentially the length of the word. </p>
  
  <p>There are also some subjective factors to (attempt to) compensate for, such as the likelihood a word is in the vocabulary of the player, and can be recognised, allowing moving from a guessing strategy based on letter frequencies alone to guessing based on list of known matching words.</p>
  
  <p>My attempt for now is below in ruby. Any suggestions on how to improve the categorisation?</p>
  
  <pre><code>def classify_word(w)
    n = w.chars.to_a.uniq.length # Num. unique chars in w
    if n &lt; 5 and w.length &gt; 4
      return WordDifficulty::Easy
    end
    if n &gt; w.length / 2
      return WordDifficulty::Hard
    else
      return WordDifficulty::Medium
    end
  end
  </code></pre>
  
  <p>I am writing a hangman game I would like my children to play; I am rather too old to be attempting "homework", which may be why the question is receiving so many down votes... 
  Words are drawn randomly from large word databases, which include many obscure words, and are being filtered by the difficulty level determined for the word.</p>