Skip to content

Instantly share code, notes, and snippets.

View PepeRoConde's full-sized avatar
💭
I think that I shall never see A poem lovely as a tree. - Joyce Kilmer

pepe PepeRoConde

💭
I think that I shall never see A poem lovely as a tree. - Joyce Kilmer
View GitHub Profile
@koreyou
koreyou / bm25.py
Created November 1, 2019 05:26
Implementation of OKapi BM25 with sklearn's TfidfVectorizer
""" Implementation of OKapi BM25 with sklearn's TfidfVectorizer
Distributed as CC-0 (https://creativecommons.org/publicdomain/zero/1.0/)
"""
import numpy as np
from sklearn.feature_extraction.text import TfidfVectorizer
from scipy import sparse
class BM25(object):