Class PassageScorer
Ranks passages found by ICUPostingsHighlighter.
Each passage is scored as a miniature document within the document. The final score is computed asnorm
* ∑ (weight
* tf
).
The default implementation is norm
* BM25.
Note
This API is experimental and might change in incompatible ways in the next release.
Inherited Members
Namespace: Lucene.Net.Search.PostingsHighlight
Assembly: Lucene.Net.ICU.dll
Syntax
public class PassageScorer
Constructors
PassageScorer()
Creates PassageScorer with these default values:
k1 = 1.2
b = 0.75
pivot = 87
Declaration
public PassageScorer()
PassageScorer(float, float, float)
Creates PassageScorer with specified scoring parameters
Declaration
public PassageScorer(float k1, float b, float pivot)
Parameters
Type | Name | Description |
---|---|---|
float | k1 | Controls non-linear term frequency normalization (saturation). |
float | b | Controls to what degree passage length normalizes tf values. |
float | pivot | Pivot value for length normalization (some rough idea of average sentence length in characters). |
Methods
Norm(int)
Normalize a passage according to its position in the document.
Typically passages towards the beginning of the document are more useful for summarizing the contents. The default implementation is1 + 1/log(pivot + passageStart)
Declaration
public virtual float Norm(int passageStart)
Parameters
Type | Name | Description |
---|---|---|
int | passageStart | start offset of the passage |
Returns
Type | Description |
---|---|
float | a boost value multiplied into the passage's core. |
Tf(int, int)
Computes term weight, given the frequency within the passage and the passage's length.
Declaration
public virtual float Tf(int freq, int passageLen)
Parameters
Type | Name | Description |
---|---|---|
int | freq | number of occurrences of within this passage |
int | passageLen | length of the passage in characters. |
Returns
Type | Description |
---|---|
float | term weight |
Weight(int, int)
Computes term importance, given its in-document statistics.
Declaration
public virtual float Weight(int contentLength, int totalTermFreq)
Parameters
Type | Name | Description |
---|---|---|
int | contentLength | length of document in characters |
int | totalTermFreq | number of time term occurs in document |
Returns
Type | Description |
---|---|
float | term importance |