Recommend this page to a friend! |
Download |
Info | Documentation | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2024-09-28 (1 month ago) | 54% | Total: 249 | All time: 7,938 This week: 60 |
Version | License | PHP version | Categories | |||
morphos 1.114 | Free for non-comm... | 5.4 | Algorithms, PHP 5, Text processing |
Description | Author | |||
This class can get the different forms of language words. Innovation Award
|
A morphological solution for Russian and English language written completely in PHP and delivered as a PHP library or docker image to integrate in non-PHP stack.
Download library through composer:
composer require wapmorgan/morphos
or install via adapter:
The server starts in a container from docker image and listens 8080 port for GET-requests.
Integrate service into your stack (for example, docker compose)
services:
morphos:
image: wapmorgan/morphos:3.2.29
ports:
- 8093:8080
or standalone container:
docker run --env NUM_WORKERS=4 --rm --publish 8093:8080 -v wapmorgan/morphos:3.2.29
_Tip_: adjust NUM_WORKERS
env variable if you will send a lot of load to service. By default, it's 4.
There are API: marks in documentation for functions, that exposed as service endpoints. Just pass them the same arguments as to PHP-functions/methods.
// Inflect russian names:
morphos\Russian\inflectName('Иванов Петр', 'родительный') => 'Иванова Петра'
// Inflect geographical names:
morphos\Russian\GeographicalNamesInflection::getCase('Москва', 'родительный') => 'Москвы'
// Pluralize russian nouns and adjectives:
morphos\Russian\pluralize(10, 'новый дом') => '10 новых домов'
// Generate russian cardinal numerals:
morphos\Russian\CardinalNumeralGenerator::getCase(567, 'именительный') => 'пятьсот шестьдесят семь'
// Generate russian ordinal numerals:
morphos\Russian\OrdinalNumeralGenerator::getCase(961, 'именительный') => 'девятьсот шестьдесят первый'
// Generate russian time difference
morphos\Russian\TimeSpeller::spellDifference(time() + 3600, morphos\TimeSpeller::DIRECTION) => 'через 1 час'
// other functions described in README-ru.md
// Pluralize english nouns:
morphos\English\pluralize(10, 'house') => '10 houses'
// Generate english cardinal numerals:
morphos\English\CardinalNumeralGenerator::generate(567) => 'five hundred sixty-seven'
// Generate english ordinal numerals:
morphos\English\OrdinalNumeralGenerator::generate(961) => 'nine hundred sixty-first'
// Generate english time difference
morphos\English\TimeSpeller::spellDifference(time() + 3600, morphos\TimeSpeller::DIRECTION) => 'in 1 hour'
See CONTRIBUTING.md for this.
Files (71) |
File | Role | Description | ||
---|---|---|---|---|
.github (1 directory) | ||||
bin (1 file) | ||||
src (12 files, 3 directories) | ||||
tests (4 files, 2 directories) | ||||
web (2 files) | ||||
.rr.yaml | Data | Auxiliary data | ||
composer.json | Data | Auxiliary data | ||
CONTRIBUTING.md | Data | Auxiliary data | ||
Dockerfile | Data | Auxiliary data | ||
LICENSE.md | Lic. | License text | ||
phpstan.neon | Data | Auxiliary data | ||
phpunit.xml.dist | Data | Auxiliary data | ||
README-en.md | Doc. | Documentation | ||
README-ru.md | Doc. | Documentation | ||
README.md | Doc. | Documentation | ||
_config.yml | Data | Auxiliary data |
Files (71) | / | src |
File | Role | Description | ||
---|---|---|---|---|
English (5 files) | ||||
Russian (16 files) | ||||
Service (2 files) | ||||
BaseInflection.php | Class | Class source | ||
BasePluralization.php | Class | Class source | ||
Cases.php | Class | Class source | ||
CasesHelper.php | Class | Class source | ||
CurrenciesHelper.php | Class | Class source | ||
Currency.php | Class | Class source | ||
Gender.php | Class | Class source | ||
MoneySpeller.php | Class | Class source | ||
NamesInflection.php | Class | Class source | ||
NumeralGenerator.php | Class | Class source | ||
S.php | Class | Class source | ||
TimeSpeller.php | Class | Class source |
Files (71) | / | src | / | English |
File | Role | Description |
---|---|---|
CardinalNumeralGenerator.php | Class | Class source |
functions.php | Aux. | Auxiliary script |
NounPluralization.php | Class | Class source |
OrdinalNumeralGenerator.php | Class | Class source |
TimeSpeller.php | Class | Class source |
Files (71) | / | src | / | Russian |
File | Role | Description |
---|---|---|
AdjectiveDeclension.php | Class | Class source |
AdjectivePluralization.php | Class | Class source |
CardinalNumeralGenerator.php | Class | Class source |
Cases.php | Class | Class source |
FirstNamesInflection.php | Class | Class source |
functions.php | Example | Example script |
GeographicalNamesInflection.php | Class | Class source |
LastNamesInflection.php | Class | Class source |
MiddleNamesInflection.php | Class | Class source |
MoneySpeller.php | Class | Class source |
NounDeclension.php | Class | Class source |
NounPluralization.php | Class | Class source |
OrdinalNumeralGenerator.php | Class | Class source |
RussianCasesHelper.php | Class | Class source |
RussianLanguage.php | Class | Class source |
TimeSpeller.php | Class | Class source |
Files (71) | / | src | / | Service |
File | Role | Description |
---|---|---|
English.php | Class | Class source |
Russian.php | Class | Class source |
Files (71) | / | tests |
File | Role | Description | ||
---|---|---|---|---|
English (5 files) | ||||
Russian (12 files) | ||||
CasesHelperTest.php | Class | Class source | ||
CurrenciesHelperTest.php | Class | Class source | ||
Dockerfile | Data | Auxiliary data | ||
Makefile | Data | Auxiliary data |
Files (71) | / | tests | / | English |
File | Role | Description |
---|---|---|
CardinalNumeralTest.php | Class | Class source |
FunctionsTest.php | Class | Class source |
NounPluralizationTest.php | Class | Class source |
OrdinalNumeralTest.php | Class | Class source |
TimeSpellerTest.php | Class | Class source |
Files (71) | / | tests | / | Russian |
File | Role | Description |
---|---|---|
AdjectiveDeclensionTest.php | Class | Class source |
AdjectivePluralizationTest.php | Class | Class source |
CardinalNumeralTest.php | Class | Class source |
FirstNamesInflecionTest.php | Class | Class source |
FunctionsTest.php | Class | Class source |
GeographicalNamesInflectionTest.php | Class | Class source |
LastNamesInflectionTest.php | Class | Class source |
MiddleNamesInflectionTest.php | Class | Class source |
MoneySpellerTest.php | Class | Class source |
NounDeclensionTest.php | Class | Class source |
NounPluralizationTest.php | Class | Class source |
RussianLanguageTest.php | Class | Class source |
Files (71) | / | web |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
User Ratings | User Comments (12) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.