original_string: public function extractEntityWords(EntityInterface $entity)
      {
          $text = '';
          $entityArray = $entity->toArray();
          $entityArray = Hash::flatten($entityArray);
          foreach ($entityArray as $key => $value) {
              if (is_string($value) || is_numeric($value)) {
                  $text .= " {$value}";
              }
          }
  
          $text = str_replace(["\n", "\r"], '', trim((string)$text)); // remove new lines
          $text = strip_tags($text); // remove HTML tags, but keep their content
          $strict = $this->config('strict');
  
          if (!empty($strict)) {
              // only: space, digits (0-9), letters (any language), ".", ",", "-", "_", "/", "\"
              $pattern = is_string($strict) ? $strict : '[^\p{L}\p{N}\s\@\.\,\-\_\/\\0-9]';
              $text = preg_replace('/' . $pattern . '/ui', ' ', $text);
          }
  
          $text = trim(preg_replace('/\s{2,}/i', ' ', $text)); // remove double spaces
          $text = mb_strtolower($text); // all to lowercase
          $text = $this->_filterText($text); // filter
          $text = iconv('UTF-8', 'UTF-8//IGNORE', mb_convert_encoding($text, 'UTF-8')); // remove any invalid character
  
          return trim($text);
      }
code: public function extractEntityWords(EntityInterface $entity)
      {
          $text = '';
          $entityArray = $entity->toArray();
          $entityArray = Hash::flatten($entityArray);
          foreach ($entityArray as $key => $value) {
              if (is_string($value) || is_numeric($value)) {
                  $text .= " {$value}";
              }
          }
  
          $text = str_replace(["\n", "\r"], '', trim((string)$text)); // remove new lines
          $text = strip_tags($text); // remove HTML tags, but keep their content
          $strict = $this->config('strict');
  
          if (!empty($strict)) {
              // only: space, digits (0-9), letters (any language), ".", ",", "-", "_", "/", "\"
              $pattern = is_string($strict) ? $strict : '[^\p{L}\p{N}\s\@\.\,\-\_\/\\0-9]';
              $text = preg_replace('/' . $pattern . '/ui', ' ', $text);
          }
  
          $text = trim(preg_replace('/\s{2,}/i', ' ', $text)); // remove double spaces
          $text = mb_strtolower($text); // all to lowercase
          $text = $this->_filterText($text); // filter
          $text = iconv('UTF-8', 'UTF-8//IGNORE', mb_convert_encoding($text, 'UTF-8')); // remove any invalid character
  
          return trim($text);
      }
code_tokens: public function extractEntityWords ( EntityInterface $ entity ) { $ text = '' ; $ entityArray = $ entity -> toArray ( ) ; $ entityArray = Hash :: flatten ( $ entityArray ) ; foreach ( $ entityArray as $ key => $ value ) { if ( is_string ( $ value ) || is_numeric ( $ value ) ) { $ text .= " {$value}" ; } } $ text = str_replace ( [ "\n" , "\r" ] , '' , trim ( ( string ) $ text ) ) ; // remove new lines $ text = strip_tags ( $ text ) ; // remove HTML tags, but keep their content $ strict = $ this -> config ( 'strict' ) ; if ( ! empty ( $ strict ) ) { // only: space, digits (0-9), letters (any language), ".", ",", "-", "_", "/", "\" $ pattern = is_string ( $ strict ) ? $ strict : '[^\p{L}\p{N}\s\@\.\,\-\_\/\\0-9]' ; $ text = preg_replace ( '/' . $ pattern . '/ui' , ' ' , $ text ) ; } $ text = trim ( preg_replace ( '/\s{2,}/i' , ' ' , $ text ) ) ; // remove double spaces $ text = mb_strtolower ( $ text ) ; // all to lowercase $ text = $ this -> _filterText ( $ text ) ; // filter $ text = iconv ( 'UTF-8' , 'UTF-8//IGNORE' , mb_convert_encoding ( $ text , 'UTF-8' ) ) ; // remove any invalid character return trim ( $ text ) ; }
docstring: Extracts a list of words to by indexed for given entity.
  
  NOTE: Words can be repeated, this allows to search phrases.
  
  @param \Cake\Datasource\EntityInterface $entity The entity for which generate
  the list of words
  @return string Space-separated list of words. e.g. `cat dog this that`
docstring_tokens: Extracts a list of words to by indexed for given entity .