This is great! Inspired me to make a little script in spark-shell:<p><pre><code>    &gt; val words = oxforddict.
                filter{case s =&gt; s.exists(_.isLetter) &amp;&amp; s.forall(Character.isUpperCase(_))}.
                distinct.
                map((_.toLowerCase,1))

    &gt; def lcp(a:String,b:String) = { a.zip(b).takeWhile(Function.tupled(_ == _)).map(_._1).mkString }
    &gt; implicit val wordOrdering = new Ordering[String] {
    &gt;   override def compare(a:String, b:String) = { val lcpIdx = lcp(a,b).length; a.substring(lcpIdx).compareTo(b.substring(lcpIdx)) }
    &gt; } 
    
    &gt; def nextGuess(lower:String,upper:String,g:Int) = { val candidates = words.filterByRange(lower,upper).map(_._1).collect.sorted(wordOrdering).toList; val mid = candidates.length &#x2F; 2; candidates.slice(mid-g&#x2F;2,mid+g&#x2F;2+1) }
    nextGuess: (lower: String, upper: String, g: Int)

    &gt; nextGuess(&quot;prejudice&quot;,&quot;promise&quot;,1)
    res42: List[String] = List(primeness)
    &gt; nextGuess(&quot;prime&quot;,&quot;promise&quot;,10)
    res47: List[String] = List(procris, procrustean, procrusteanize, procrustes, procrustesian, proctitis, proctocele, proctodaeum, proctor, proctorage, proctorial)
    &gt; nextGuess(&quot;proctor&quot;,&quot;promise&quot;,10)
    res48: List[String] = List(profulgent, profundity, profuse, profusely, profuseness, profusion, profusive, prog, progenerate, progeneration, progenitor)
    &gt; nextGuess(&quot;profuse&quot;,&quot;promise&quot;,12)
    ding ding!!
</code></pre>
I love HN, and I love scala :D Thanks for posting OP. HN needs more great technical content like this and less opinion &amp; news, in my opinion.