Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Don't consider a post related to itself
- Loading branch information
Showing
with
2 additions
and
1 deletion.
-
+2
−1
v7/similarity/similarity.py
|
@@ -104,8 +104,9 @@ def write_similar(path, post, lang, indexes=indexes, dictionaries=dictionaries, |
|
|
title_sims = [title_similarity(post, p) for p in self.site.timeline] |
|
|
full_sims = [tag_sims[i] + title_sims[i] + body_sims[i] * 1.5 for i in range(len(self.site.timeline))] |
|
|
full_sims = sorted(enumerate(full_sims), key=lambda item: -item[1]) |
|
|
idx = self.site.timeline.index(post) |
|
|
related = [(self.site.timeline[s[0]], s[1], tag_sims[s[0]], title_sims[s[0]], body_sims[s[0]]) for s in |
|
|
full_sims[:11] if s[0] != i] |
|
|
full_sims[:11] if s[0] != idx] |
|
|
data = [] |
|
|
for p, score, tag, title, body in related: |
|
|
data.append({ |
|
|