private function getBaselineScoreForSiblings(Element $topNode): float {
        $base = 100000;
        $numberOfParagraphs = 0;
        $scoreOfParagraphs = 0;
        $nodesToCheck = $topNode->find('p, strong');

        foreach ($nodesToCheck as $node) {
            $nodeText = $node->text();
            $wordStats = $this->config()->getStopWords()->getStopwordCount($nodeText);
            $highLinkDensity = $this->isHighLinkDensity($node);

            if ($wordStats->getStopWordCount() > 2 && !$highLinkDensity) {
                $numberOfParagraphs += 1;
                $scoreOfParagraphs += $wordStats->getStopWordCount();
            }
        }

        if ($numberOfParagraphs > 0) {
            $base = $scoreOfParagraphs / $numberOfParagraphs;
        }

        return $base;
    }
private function getBaselineScoreForSiblings(Element $topNode): float {
        $base = 100000;
        $numberOfParagraphs = 0;
        $scoreOfParagraphs = 0;
        $nodesToCheck = $topNode->find('p, strong');

        foreach ($nodesToCheck as $node) {
            $nodeText = $node->text();
            $wordStats = $this->config()->getStopWords()->getStopwordCount($nodeText);
            $highLinkDensity = $this->isHighLinkDensity($node);

            if ($wordStats->getStopWordCount() > 2 && !$highLinkDensity) {
                $numberOfParagraphs += 1;
                $scoreOfParagraphs += $wordStats->getStopWordCount();
            }
        }

        if ($numberOfParagraphs > 0) {
            $base = $scoreOfParagraphs / $numberOfParagraphs;
        }

        return $base;
    }
private function getBaselineScoreForSiblings ( Element $ topNode ) : float { $ base = 100000 ; $ numberOfParagraphs = 0 ; $ scoreOfParagraphs = 0 ; $ nodesToCheck = $ topNode -> find ( 'p, strong' ) ; foreach ( $ nodesToCheck as $ node ) { $ nodeText = $ node -> text ( ) ; $ wordStats = $ this -> config ( ) -> getStopWords ( ) -> getStopwordCount ( $ nodeText ) ; $ highLinkDensity = $ this -> isHighLinkDensity ( $ node ) ; if ( $ wordStats -> getStopWordCount ( ) > 2 && ! $ highLinkDensity ) { $ numberOfParagraphs += 1 ; $ scoreOfParagraphs += $ wordStats -> getStopWordCount ( ) ; } } if ( $ numberOfParagraphs > 0 ) { $ base = $ scoreOfParagraphs / $ numberOfParagraphs ; } return $ base ; }
we could have long articles that have tons of paragraphs so if we tried to calculate the base score against
the total text score of those paragraphs it would be unfair. So we need to normalize the score based on the average scoring
of the paragraphs within the top node. For example if our total score of 10 paragraphs was 1000 but each had an average value of
100 then 100 should be our base.

@param Element $topNode

@return float
we could have long articles that have tons of paragraphs so if we tried to calculate the base score against the total text score of those paragraphs it would be unfair . So we need to normalize the score based on the average scoring of the paragraphs within the top node . For example if our total score of 10 paragraphs was 1000 but each had an average value of 100 then 100 should be our base .