public function check() {
    foreach( $this->dictionary as $word ):
      $rule = "alone";
      if( is_array($word) ) {
        $rule = isset($word[1]) ? $word[1] : $rule;
        $word = $word[0];
      }
      $word = preg_replace("/([^\w ]*)/iu", "", $word);
      if( "among" === $rule ) {
        if( preg_match("/(" . $word . ")/iu", $this->text ) ) return true;
      } else {
        if( preg_match("/(\b)+(" . $word . ")+(\b)/iu", $this->text ) ) return true;
      }
    endforeach;
    return false;
  }
public function check() {
    foreach( $this->dictionary as $word ):
      $rule = "alone";
      if( is_array($word) ) {
        $rule = isset($word[1]) ? $word[1] : $rule;
        $word = $word[0];
      }
      $word = preg_replace("/([^\w ]*)/iu", "", $word);
      if( "among" === $rule ) {
        if( preg_match("/(" . $word . ")/iu", $this->text ) ) return true;
      } else {
        if( preg_match("/(\b)+(" . $word . ")+(\b)/iu", $this->text ) ) return true;
      }
    endforeach;
    return false;
  }
public function check ( ) { foreach ( $ this -> dictionary as $ word ) : $ rule = "alone" ; if ( is_array ( $ word ) ) { $ rule = isset ( $ word [ 1 ] ) ? $ word [ 1 ] : $ rule ; $ word = $ word [ 0 ] ; } $ word = preg_replace ( "/([^\w ]*)/iu" , "" , $ word ) ; if ( "among" === $ rule ) { if ( preg_match ( "/(" . $ word . ")/iu" , $ this -> text ) ) return true ; } else { if ( preg_match ( "/(\b)+(" . $ word . ")+(\b)/iu" , $ this -> text ) ) return true ; } endforeach ; return false ; }
Checks for bad words in the text but verifies each dictionary word rule,
like alone ou among each word in the text.

@return boolean
Checks for bad words in the text but verifies each dictionary word rule like alone ou among each word in the text .