public function getPhrases()
    {   
        $phrases = [];

        for($index = $this->nGramSize; $index >= 2; $index--)
        {                     
            $phrases = array_merge($phrases, NGramFactory::create($this->getTokens(), $index));                        
        }
        
        // you cannot use a phrase if it is a substring of a longer phrase
        // we must exclude all of the substring phrases        
        $add = [];
        $remove = [];
        foreach($phrases as $phrase) 
        {   
            if(isset($remove[$phrase])) {
                continue;
            } elseif (!isset($add[$phrase])) {
                $add[$phrase] = true;
                // remove the suffix word
                $remove[substr($phrase, 0, strrpos($phrase," "))] = true; 
                //remove the prefix            
                $remove[substr($phrase, strpos($phrase," ")+1)] = true;                 
            }
        }        
        return array_keys($add);        
    }
public function getPhrases()
    {   
        $phrases = [];

        for($index = $this->nGramSize; $index >= 2; $index--)
        {                     
            $phrases = array_merge($phrases, NGramFactory::create($this->getTokens(), $index));                        
        }
        
        // you cannot use a phrase if it is a substring of a longer phrase
        // we must exclude all of the substring phrases        
        $add = [];
        $remove = [];
        foreach($phrases as $phrase) 
        {   
            if(isset($remove[$phrase])) {
                continue;
            } elseif (!isset($add[$phrase])) {
                $add[$phrase] = true;
                // remove the suffix word
                $remove[substr($phrase, 0, strrpos($phrase," "))] = true; 
                //remove the prefix            
                $remove[substr($phrase, strpos($phrase," ")+1)] = true;                 
            }
        }        
        return array_keys($add);        
    }
public function getPhrases ( ) { $ phrases = [ ] ; for ( $ index = $ this -> nGramSize ; $ index >= 2 ; $ index -- ) { $ phrases = array_merge ( $ phrases , NGramFactory :: create ( $ this -> getTokens ( ) , $ index ) ) ; } // you cannot use a phrase if it is a substring of a longer phrase // we must exclude all of the substring phrases         $ add = [ ] ; $ remove = [ ] ; foreach ( $ phrases as $ phrase ) { if ( isset ( $ remove [ $ phrase ] ) ) { continue ; } elseif ( ! isset ( $ add [ $ phrase ] ) ) { $ add [ $ phrase ] = true ; // remove the suffix word $ remove [ substr ( $ phrase , 0 , strrpos ( $ phrase , " " ) ) ] = true ; //remove the prefix             $ remove [ substr ( $ phrase , strpos ( $ phrase , " " ) + 1 ) ] = true ; } } return array_keys ( $ add ) ; }
Get all the possible phrases
@return array
Get all the possible phrases