MCPcopy Create free account
hub / github.com/Tjatse/node-readability / scoreNode

Function scoreNode

lib/reader.js:590–602  ·  view source on GitHub ↗

* Add score to the node. * @param node the node element. * @param score score bonus. * @param cans candidates. * @param scoreRule function of scoring.

(node, score, cans, scoreRule)

Source from the content-addressed store, hash-verified

588 * @param scoreRule function of scoring.
589 */
590function scoreNode(node, score, cans, scoreRule){
591 if (!node.data(scoreKey)) {
592 score += initNode(node);
593 cans.push(node);
594 } else {
595 score += node.data(scoreKey);
596 }
597 if (typeof scoreRule == 'function') {
598 var sr = scoreRule(node);
599 score += !isNaN(sr) ? sr : 0;
600 }
601 node.data(scoreKey, score);
602}
603
604/**
605 * Get a node's weight by regular expressions.

Callers 1

getNodeWeightFunction · 0.85

Calls 1

initNodeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…