GithubHelp home page GithubHelp logo

php-mystem's Introduction

Php-MyStem

A PHP wrapper for Yandex MyStem program https://yandex.ru/dev/mystem/

Installation

  1. Add the github repo:
composer config repositories.php-mystem vcs https://github.com/sheronov/php-mystem
  1. Require the package
composer require sheronov/php-mystem
  1. On first launch, the package will download mystem binaries from yandex, but you can do it manually
 ./vendor/bin/mystem-downloader.php

By default, it downloads all mystem binaries for Windows, Linux and macOS.
If you want download only for one system, please provide an argument:

  • -l - bin for Linux
  • -w - exe for Windows
  • -m - bin for Macos

Usage

lemmatization (Приведение словоформы к лемме — её нормальной (словарной) форме.)

use Sheronov\PhpMyStem\MyStem;

MyStem::lemma('Бегущий'); //бежать

MyStem::lemmatization('Бегущий по лезвию'); /* array (
  0 =>
  array (
    'text' => 'Бегущий',
    'lemma' => 'бежать',
    'weight' => 1,
    'gram' => 'V,нп=(непрош,вин,ед,прич,полн,муж,несов,действ,неод|непрош,им,ед,прич,полн,муж,несов,действ)',
    'part_letter' => 'V',
    'part_more' => 'verb',
    'wrong' => false,
  ),
  1 =>
  array (
    'text' => 'по',
    'lemma' => 'по',
    'weight' => 1,
    'gram' => 'PR=',
    'part_letter' => 'PR',
    'part_more' => 'preposition',
    'wrong' => false,
  ),
  2 =>
  array (
    'text' => 'лезвию',
    'lemma' => 'лезвие',
    'weight' => 1,
    'gram' => 'S,сред,неод=дат,ед',
    'part_letter' => 'S',
    'part_more' => 'noun',
    'wrong' => false,
  ),
)
*/

Raw binary run with custom arguments from Yandex docs

\Sheronov\PhpMyStem\MyStem::run($someText, ['--weight', '-gi']); // unprepared decoded array from json 

php-mystem's People

Contributors

sheronov avatar novoselovmaks avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.