Warning: session_start(): open(/var/lib/php/sessions/sess_8tur5isdc0hfoujqinpitc8dmh, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
static double ai_gc_scan_maxDistance_reached;
static S ai_gc_scan(S root) {
ai_gc_clear();
time "GC Scan" {
ai_postTriple(root, "has GC distance", "0");
Map distances = litcimap(root, 0.0);
LinkedList queue = litLinkedList(root);
S word;
while ping ((word = queue.poll()) != null) {
double d = distances.get(word);
for (WebNode node : indexedNodes(word)) {
for (WebRelation r : web_forwardRelations(node)) {
double dist = ai_gc_distanceFunction(web_text(r), true);
if (!isNaN(dist))
ai_gc_scan_update(distances, queue, r.b, d+dist);
}
for (WebRelation r : web_backwardRelations(node)) {
double dist = ai_gc_distanceFunction(web_text(r), false);
if (!isNaN(dist))
ai_gc_scan_update(distances, queue, r.a, d+dist);
}
}
}
Collection keys = keys(distances);
if (ai_inTestMode())
keys = keysSortedByValueDesc(distances);
ai_gc_scan_maxDistance_reached = 0;
for (S key : keys) {
double d = distances.get(key);
if (d > ai_gc_scan_maxDistance_reached) ai_gc_scan_maxDistance_reached = d;
ai_postTriple(key, "has GC distance", formatDouble(d, 1));
}
}
ret print(l(distances) + "/" + l(indexedTerms()) + " terms were reached in " + toS(lastTiming(), 1) + " s GC scan from " + quote(root) + ". Max distance: " + formatDouble(ai_gc_scan_maxDistance_reached, 1));
}
static void ai_gc_scan_update(Map distances, L queue, WebNode n, double d) {
//S text = ai_shortenForIndex(web_text(n));
Double od = distances.get(text);
if (od == null || d < od) {
distances.put(text, d);
queue.add(text);
}
}