gnome-do relevance for python

I ported the text relevance engine from gnome-do to Python. You can download it here.

>>> import relevance
>>> relevance.score('hi there dude', 'hi dude')
0.53480769230769232
>>> relevance.formatCommonSubstrings('hi there dude', 'hi dude')
'<b>hi </b>there <b>dude</b>'

Comments (3)

  1. Another cool feature for dronedoc. Rock on.

    Saturday, September 20, 2008 at 11:31 pm #
  2. ulrik wrote:

    Hi Christian! I just wanted to ping to say that I’ve rewritten some parts of the relevance module. The most important part, performance-wise, is _findBestMatch where I rewrote and cleaned up the loop to use faster python constructs. String ranking is now faster: 2x for len 1 query, 4x for len 4, even better improvement for longer queries.

    File is here, all changes are available in the project history:

    http://git.gnome.org/cgit/kupfer/tree/kupfer/relevance.py

    Sunday, September 13, 2009 at 11:04 pm #
  3. chergert wrote:

    Awesome!

    Monday, September 14, 2009 at 1:02 am #