PHP code example of ropendev / expression

1. Go to this page and download the library: Download ropendev/expression library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ropendev / expression example snippets



use \rOpenDev\curl\CurlRequest;

...
// Configure
$test = new \rOpenDev\ExtractExpression\ExtractExpression();
$test->onlyInSentence     = true; // Default value: FALSE
$test->expressionMaxWords = 5;    // Max expression size in words
$test->keepTrail          = 5; // Don't keep trail for less than 3 occurences found ine one text
$test->addContent("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed...");

// Get Results
$test->getExpressions(int max = 0); // @return array with expression => number
$test->getTrail('expression'); // @return array with sentence where we find expression (best with onlyInSentence = true)
$test->getTrails(); // @return array with expression => array trails

$test->getWordNumber(); // @return int