2024-02-22 18:01:35 +01:00
|
|
|
package nu.marginalia.ranking.domains;
|
2024-02-16 18:04:58 +01:00
|
|
|
|
2024-02-22 18:01:35 +01:00
|
|
|
import nu.marginalia.ranking.domains.accumulator.RankingResultListAccumulator;
|
2024-02-16 20:22:01 +01:00
|
|
|
import org.junit.jupiter.api.Disabled;
|
2024-02-16 18:04:58 +01:00
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
2024-02-16 20:22:01 +01:00
|
|
|
// Test the ranking algorithm with prod data. Will not run if the data is not available.
|
|
|
|
// It's not feasible to include the data in the git repo, as it's ~6 GB of data.
|
|
|
|
@Disabled
|
2024-02-16 18:04:58 +01:00
|
|
|
class RankingAlgorithmWithRealDataTest {
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testRegularPR() {
|
|
|
|
if (!TestGraphSourceForLinkData.isAvailable()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var graphSource = new TestGraphSourceForLinkData();
|
|
|
|
var results = new PageRankDomainRanker(graphSource, List.of())
|
|
|
|
.calculate(10, RankingResultListAccumulator::new);
|
|
|
|
|
|
|
|
for (int i = 0; i < results.size(); i++) {
|
|
|
|
System.out.println(i + " " + graphSource.getName(results.get(i)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testInvertedLinkGraph() {
|
|
|
|
if (!TestGraphSourceForInvertedLinkData.isAvailable()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var graphSource = new TestGraphSourceForInvertedLinkData();
|
|
|
|
var results = new PageRankDomainRanker(graphSource, List.of())
|
|
|
|
.calculate(10, RankingResultListAccumulator::new);
|
|
|
|
|
|
|
|
for (int i = 0; i < results.size(); i++) {
|
|
|
|
System.out.println(i + " " + graphSource.getName(results.get(i)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testSimilarityPR() {
|
|
|
|
if (!TestGraphSourceForSimilarityData.isAvailable()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var graphSource = new TestGraphSourceForSimilarityData();
|
|
|
|
var results = new PageRankDomainRanker(graphSource, List.of())
|
|
|
|
.calculate(10, RankingResultListAccumulator::new);
|
|
|
|
|
|
|
|
for (int i = 0; i < results.size(); i++) {
|
|
|
|
System.out.println(i + " " + graphSource.getName(results.get(i)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testSimilarityPPR() {
|
|
|
|
if (!TestGraphSourceForSimilarityData.isAvailable()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var graphSource = new TestGraphSourceForSimilarityData();
|
|
|
|
var results = new PageRankDomainRanker(graphSource,
|
|
|
|
List.of(1476552) // wiby.me
|
|
|
|
)
|
|
|
|
.calculate(10, RankingResultListAccumulator::new);
|
|
|
|
|
|
|
|
for (int i = 0; i < results.size(); i++) {
|
|
|
|
System.out.println(i + " " + graphSource.getName(results.get(i)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|