count; } /** * Set raw keywords from array * * @param array $keywords_raw Associative array [ keyword => featured ], ordered by featured desc. * @return Data_Content_Storage */ public function set_raw_keywords( array $keywords_raw ) { $this->content = ''; $this->keywords = []; foreach ( $keywords_raw as $word => $featured ) { $this->keywords[] = new Data_Keyword_Tfidf( "{$word}", $featured ); } return $this; } /** * Get keywords * * @return Data_Keyword_Tfidf[] List of keyword items. */ public function get_keywords() { return $this->keywords; } /** * Set content * * @param string $content Words divided by space, all tags and some punctuation replaced by '|'. * @return Data_Content_Storage */ public function set_content( $content ) { $this->content = $content; $this->count = strlen( $content ) ? substr_count( $content, ' ' ) + substr_count( $content, '|' ) + 1 : 0; return $this; } /** * Get content * * @return string Words divided by space, all tags and some punctuation replaced by '|'. */ public function get_content() { return $this->content; } }