count map for the candidate's content. * * @var array */ public array $word_counts; /** * Total stemmed-word count (sum of $word_counts values). * * Stored separately so the TF-IDF scorer doesn't recompute it for * every phrase it scores. * * @var int */ public int $word_total; /** * Pre-stemmed, space-joined target keywords. * * @var array */ public array $target_keywords; /** * @since 1.0.0 * * @param PostModel $post The candidate post or term. * @param array $word_counts Stem counts. Default []. * @param int $word_total Optional. Total word count. * Defaults to `array_sum($word_counts)`. * @param array $target_keywords Optional. Stemmed target keywords. * Default []. */ public function __construct( PostModel $post, array $word_counts = array(), int $word_total = -1, array $target_keywords = array() ) { $this->post = $post; $this->word_counts = $word_counts; $this->word_total = $word_total >= 0 ? $word_total : (int) array_sum( $word_counts ); $this->target_keywords = $target_keywords; } }