Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Corpus ¶
type Corpus struct { // TermCount stores all terms appeared in the corpus as key // and the # of docs containing the term as value. It is // used for calculating idf. TermCount map[string]float64 // Corpus stores all documents with it's content hash as key // and the document as value. It is used for calculating idf. Documents map[string]Document }
Corpus defines Corpus
type Document ¶
type Document struct { ID string Content string Terms []string // contains filtered or unexported fields }
Document defines Document
type TFIDF ¶
type TFIDF struct { Corpus *Corpus // contains filtered or unexported fields }
TFIDF defines TFIDF
func NewTFIDFWithTokenizer ¶
NewTFIDFWithTokenizer factory
func (*TFIDF) AddDoc ¶
AddDoc adds doc to the corpus by: 1. Update Corupus for later calculation of other doc's idf (as numerator) 2. Update TermDocMap for later calculation of other docs's idf (as denominator)
Click to show internal directories.
Click to hide internal directories.