public function summarize(array $wordTokens, array $sentenceTokens) : array
    {
        $tokenCounts = array_count_values($wordTokens);
        $scoreKeepers = [];
        for($index = 0; $index < count($sentenceTokens); $index++)
        {
            $scoreKeepers[] = new ScoreKeeper($sentenceTokens[$index], $index);
        }
                       
        foreach($tokenCounts as $token => $freq)
        {
            foreach($scoreKeepers as $sentenceKeeper)
            {
                if(strpos($sentenceKeeper->getToken(), $token) !== false) {
                    
                    $sentenceKeeper->addToScore($freq);
                }
            }
        } 
        
        usort($scoreKeepers, 'score_keeper_sort');
        return $scoreKeepers;
    }
public function summarize(array $wordTokens, array $sentenceTokens) : array
    {
        $tokenCounts = array_count_values($wordTokens);
        $scoreKeepers = [];
        for($index = 0; $index < count($sentenceTokens); $index++)
        {
            $scoreKeepers[] = new ScoreKeeper($sentenceTokens[$index], $index);
        }
                       
        foreach($tokenCounts as $token => $freq)
        {
            foreach($scoreKeepers as $sentenceKeeper)
            {
                if(strpos($sentenceKeeper->getToken(), $token) !== false) {
                    
                    $sentenceKeeper->addToScore($freq);
                }
            }
        } 
        
        usort($scoreKeepers, 'score_keeper_sort');
        return $scoreKeepers;
    }
public function summarize ( array $ wordTokens , array $ sentenceTokens ) : array { $ tokenCounts = array_count_values ( $ wordTokens ) ; $ scoreKeepers = [ ] ; for ( $ index = 0 ; $ index < count ( $ sentenceTokens ) ; $ index ++ ) { $ scoreKeepers [ ] = new ScoreKeeper ( $ sentenceTokens [ $ index ] , $ index ) ; } foreach ( $ tokenCounts as $ token => $ freq ) { foreach ( $ scoreKeepers as $ sentenceKeeper ) { if ( strpos ( $ sentenceKeeper -> getToken ( ) , $ token ) !== false ) { $ sentenceKeeper -> addToScore ( $ freq ) ; } } } usort ( $ scoreKeepers , 'score_keeper_sort' ) ; return $ scoreKeepers ; }
Returns each sentenced scored.
@param array $wordTokens
@param array $sentenceTokens
@return array
Returns each sentenced scored .