[mythtv] Predictive text input method

Ian Campbell ijc at hellion.org.uk
Wed Dec 15 15:51:41 UTC 2004

On Wed, 2004-12-15 at 14:39 +0000, Allan Stirling wrote:
> Colin Guthrie wrote:
> > Allan Stirling wrote:
> >> To find a program called 'New Yankee' (With a remote mapped 2abc 3def 
> >> 4ghi 5jkl 6mno 7pqrs 8tuv 9wxyz 0space) the input would be
> >> 639092633, possibly refining the search as the input is being typed...
> >>
> > 
> > 
> > I said before the weekend (this idea was also mentioned by Ian Cambell 
> > in this thread last week), I used to have a C++ class that implemented 
> > this sort of searching based on a dictionary you load (e.g. all the 
> > words in the search space!! or /usr/share/dict/words).
> > 
> > Giving the class a number sequence as input, it would return all the 
> > words that begin with those letter combinations.
> > 
> > It worked quite well.
> > 
> > I said I'd try and dig it out (it was written about 3 or 4 years ago!) 
> > and slap up a few tests before integrating it into myth.
> No real need, I think. Looking at this a little:
> Looking for 'Alias' and typing just 2542 gives us what we want. 1 extra 
> letter brings it down to 3 results.

I did some experiments (with a crappy Perl script) over my mp3
collection (around 200 albums) on Sunday I posted some stuff here but it
was caught by the list filters (too big) and I was on my way out the
door and I never managed to trim it down and post it again.

The script did a depth first search across the possible numeric pad
inputs, and creates a regex by mapping 2-9 to the letters (and numbers)
marked on my remote, 0 to "0" or whitespace and 1 to everything else (so
1 and punctuation basically). It stopped when the list of matching
albums (artist and title) reached <8 (which was my target for fitting on
a TV screen).

The maximum key sequence that was required to bring the match list down
to <=8 with my collection was 7 and for the nearly all of the albums the
most sensible things you would enter when looking for them took just 4-5
keys to produce a useful shortlist. 

The matches of length seven were all, without exception, (a) albums by
"various" or (b) artists/albums named "the be_" which matched "the best
of..." (mostly), "the beatles" and "the bends". If you searched for the
artist whose "best of" you wanted, or just "beatles" or "radiohead" you
got the match in less than 7 entries.

Most of the sequences of length 6 were the same, partial matches on
"various" and titles etc starting with "the".

The results of the experiment were encouraging enough (to me) that I'm
intending to continue digging with the internals of mythmusic to see how
it works out in practise.


Ian Campbell

We are Microsoft.  Unix is irrelevant.  Openness is futile.  Prepare
to be assimilated.

More information about the mythtv-dev mailing list