Skip to content

Commit

Permalink
golint
Browse files Browse the repository at this point in the history
  • Loading branch information
boyter committed Jun 11, 2020
1 parent a5db986 commit b85edab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ add proximity search "this is"~5 which means they need to be within 5 bytes of e
JSON endpoint for HTTP just in case someone wants to build own stuff
Save to disk output
MAYBE
HTML parser option
Expand Down
8 changes: 4 additions & 4 deletions processor/result_ranker.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const (
LocationBoostValue = 0.05
DefaultScoreValue = 0.01
PhraseBoostValue = 1.00
BytesWordDivisor = 2
BytesWordDivisor = 2
)

// Given the results boost based on how close the phrases are to each other IE make it slightly phrase
Expand Down Expand Up @@ -164,7 +164,7 @@ func rankResultsTFIDF(corpusCount int, results []*fileJob, documentFrequencies m

if Ranker == "tfidfl" {
// Lucene modification to improve results https://opensourceconnections.com/blog/2015/10/16/bm25-the-next-generation-of-lucene-relevation/
weight += math.Sqrt(tf) * idf * (1/math.Sqrt(words))
weight += math.Sqrt(tf) * idf * (1 / math.Sqrt(words))
} else {
weight += tf * idf
}
Expand Down Expand Up @@ -200,7 +200,7 @@ func rankResultsBM25(corpusCount int, results []*fileJob, documentFrequencies ma
for i := 0; i < len(results); i++ {
averageDocumentWords += float64(maxInt(1, results[i].Bytes/BytesWordDivisor))
}
averageDocumentWords = averageDocumentWords/float64(len(results))
averageDocumentWords = averageDocumentWords / float64(len(results))

k1 := 1.2
b := 0.75
Expand All @@ -224,7 +224,7 @@ func rankResultsBM25(corpusCount int, results []*fileJob, documentFrequencies ma
idf := math.Log10(float64(corpusCount) / float64(documentFrequencies[word]))

step1 := idf * tf * (k1 + 1)
step2 := tf + k1 * (1 - b + (b * words / averageDocumentWords))
step2 := tf + k1*(1-b+(b*words/averageDocumentWords))

weight += step1 / step2
}
Expand Down

0 comments on commit b85edab

Please sign in to comment.