定制 hewison/inflection 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

hewison/inflection

Composer 安装命令:

composer require hewison/inflection

包简介

README 文档

README

A library to inflect adjectives, conjugate verbs and pluralize/singularize nouns.

Usage

composer require hewison/inflection

use Hewison\Inflection\Word;

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

$word->get();

Output

    [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
        )

It is also possible to return just the words you are interested in.

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.

Additionally if you know what type of word you are working with, you can use the sub libraries on their own.

NOTE: the methods below to not undergo the same library checks as using the Word class.

Nouns

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

Adjectives

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

Verbs

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

统计信息

  • 总下载量: 3.05k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-11-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固