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)
Another cool feature for dronedoc. Rock on.
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
Awesome!