Created
May 28, 2010 12:45
-
-
Save ryszard/417110 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from ngrams import Ngrams, CharNgrams | |
def distance(left, right): | |
season = abs(int(left.get('season') or 0) - int(right.get('season') or 0)) | |
number = abs(int(left.get('number') or 0) - int(right.get('number') or 0)) | |
title = 1 - (CharNgrams(left.get('title', '')) * CharNgrams(right.get('title', ''))) | |
#description = 1 - (Ngrams(left.get('description', '')) * Ngrams(right.get('description', ''))) | |
return season * 5 + number * 5 + title * 15# + description * 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment