pymystem3 package

Environment variables

MYSTEM_BIN

Path to mystem binary by default. If not set, will use pymystem3.constants.MYSTEM_BIN.

Submodules

pymystem3.constants module

pymystem3.constants.MYSTEM_BIN = '/Users/negval/.local/bin/mystem'

Full path to mystem binary

pymystem3.constants.MYSTEM_DIR = '/Users/negval/.local/bin'

Directory of mystem binary

pymystem3.constants.MYSTEM_EXE = 'mystem'

Name of mystem binary

pymystem3.metadata module

Project metadata.

Information describing the project.

pymystem3.mystem module

A Python wrapper of the Yandex Mystem 3.0 morphological analyzer.

class pymystem3.mystem.Mystem(mystem_bin=None, grammar_info=True, disambiguation=True, entire_input=True)[source]

Bases: object

Wrap mystem binary to be able it use from Python.

The two main methods you may use are the __init__() initializer, and the analyze() method to process your data and get mystem output results.

Parameters:
  • mystem_bin (str) – path to mystem binary
  • grammar_info (bool) – glue grammatical information for same lemmas in output.
  • disambiguation (bool) – apply disambiguation
  • entire_input (bool) – copy entire input to output

Note

Default value of mystem_bin can be overwritted by MYSTEM_BIN.

analyze(text)[source]

Make morphology analysis for a text.

Parameters:text (str) – text to analyze
Returns:result of morphology analysis.
Return type:dict
lemmatize(text)[source]

Make morphology analysis for a text and return list of lemmas.

Parameters:text (str) – text to analyze
Returns:list of lemmas
Return type:list
start()[source]

Run mystem binary.

Note

It is not mandatory to call it. Use it if you want to avoid waiting for mystem loads.

pymystem3.mystem.autoinstall(out=<open file '<stderr>', mode 'w' at 0x10025b1e0>)[source]

Install mystem binary as MYSTEM_BIN. Do nothing if already installed.

pymystem3.mystem.install(out=<open file '<stderr>', mode 'w' at 0x10025b1e0>)[source]

Install mystem binary as MYSTEM_BIN. Overwrite if already installed.

Module contents

Table Of Contents

Previous topic

pymystem3

This Page