mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-23 21:18:58 +00:00
(index) Adding a few experimental relevance signals
This commit is contained in:
parent
57929ff242
commit
d8a99784e5
@ -216,6 +216,9 @@ public class IndexResultScoreCalculator {
|
||||
int bestCoherenceTitle = coherences.testOptional(positions, spans.title);
|
||||
int bestCoherenceHeading = coherences.testOptional(positions, spans.heading);
|
||||
|
||||
boolean allInTitle = coherences.allOptionalInSpan(positions, spans.title);
|
||||
boolean allInHeading = coherences.allOptionalInSpan(positions, spans.heading);
|
||||
|
||||
float[] weightedCounts = new float[compiledQuery.size()];
|
||||
int firstPosition = Integer.MAX_VALUE;
|
||||
|
||||
@ -255,7 +258,9 @@ public class IndexResultScoreCalculator {
|
||||
+ bestCoherenceAll
|
||||
+ bestCoherenceTitle
|
||||
+ bestCoherenceHeading
|
||||
+ numCoherenceAll / 4.;
|
||||
+ numCoherenceAll / 4.
|
||||
+ (allInTitle ? 5.0 : 0)
|
||||
+ (allInHeading ? 2.5 : 0);
|
||||
|
||||
double tcfAvgDist = rankingParams.tcfAvgDist * (1.0 / calculateAvgMinDistance(positionsQuery, ctx));
|
||||
double tcfFirstPosition = rankingParams.tcfFirstPosition * (1.0 / Math.max(1, firstPosition));
|
||||
|
@ -73,6 +73,16 @@ public class TermCoherenceGroupList {
|
||||
return best;
|
||||
}
|
||||
|
||||
public boolean allOptionalInSpan(CodedSequence[] positions, DocumentSpan span) {
|
||||
for (var coherenceSet : optionalGroups) {
|
||||
if (!coherenceSet.test(span, positions)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static final class TermCoherenceGroup {
|
||||
private final int[] offsets;
|
||||
private final BitSet present;
|
||||
|
Loading…
Reference in New Issue
Block a user