PHP code example of hewison / inflection

1. Go to this page and download the library: Download hewison/inflection 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/ */

    

hewison / inflection example snippets


use Hewison\Inflection\Word;

$word = Word::create("back");

$word->get();

    [adjective] => Array
        (
            [standard] => back
            [comparative] => more back
            [superlative] => most back
        )
    [adverb] => back
    [noun] => Array
        (
            [singular] => back
            [plural] => backs
        )

    [verb] => Array
        (
            [entry] => back
            [tense] => Present
            [past] => backed
            [past_participle] => backed
            [present] => back
            [present_third] => backs
            [gerund] => backing
        )

use Hewison\Inflection\Word;

$word = Word::create("back");

$word->getVerb(); // returns verb in all tenses.
$word->getAdverb(); // returns entered word if is adverb
$word->getNoun(); // returns singular and plural forms of entered, if it is a noun. Proper nouns and gibberish will still be processed here.
$word->getAdjective(); // returns adjective with superlative and comparative forms.

Hewison\Inflection\Noun\Noun::toSingular("tables"); // table
Hewison\Inflection\Noun\Noun::toPlural("bear")' // bears
Hewison\Inflection\Noun\Noun::isSingular("tables"); // false
Hewison\Inflection\Noun\Noun::isPlural("bears"); // true
Hewison\Inflection\Noun\Noun::isCountable("economics"); // false

Hewison\Inflection\Adjective\Adjective::resolveSuperlativeForm("boring"); // most boring
Hewison\Inflection\Adjective\Adjective::resolveComparativeForm("boring"); // more boring
Hewison\Inflection\Adjective\Adjective::resolveAllForms("boring"); // array

Hewison\Inflection\Verb\Verb::create("go")->conjugate(); // array of all forms
Hewison\Inflection\Verb\Verb::create("go")->toGerund(); // Gerund form
Hewison\Inflection\Verb\Verb::create("go")->toPast(); // Past form
Hewison\Inflection\Verb\Verb::create("go")->toPastParticiple(); // Past Participle form
Hewison\Inflection\Verb\Verb::create("go")->toPresentThird(); // Present Third form
Hewison\Inflection\Verb\Verb::create("go")->toPresent(); // Present form

$verb = new Verb("walk");

$verb->toGerund(); // walking