Skip to content

Instantly share code, notes, and snippets.

View bernatfortet's full-sized avatar

Bernat Fortet bernatfortet

View GitHub Profile
// search returns array of matching docs ranked by tf-idf score
// aka term frequency * inverse document frequency
//
// tf = # of occurences of term in document / # of words in document
// idf = log ( # of documents / # of documents with term )
// tf-idf = tf * idf
// multi-term tf-idf = sum of tf-idf scores (per document)
type Doc = string