Module: Myasorubka::Mystem

Extended by:
Mystem
Included in:
Mystem
Defined in:
lib/myasorubka/mystem.rb

Overview

Defined Under Namespace

Modules: Binary

Constant Summary collapse

GRAMMEMES =
{
  'A'       => :adjective,
  'ADV'     => :adverb,
  'ADVPRO'  => :adv_pronoun,
  'ANUM'    => :adj_numeral,
  'APRO'    => :adj_pronoun,
  'COM'     => :composite,
  'CONJ'    => :conjunction,
  'INTJ'    => :interjunction,
  'NUM'     => :numeral,
  'PART'    => :particle,
  'PR'      => :preposition,
  'S'       => :substantive,
  'SPRO'    => :subst_pronoun,
  'V'       => :verb,
  'наст'    => :present,
  'praes'   => :present,
  'непрош'  => :notpast,
  'inpraes' => :notpast,
  'прош'    => :past,
  'praet'   => :past,
  'им'      => :nominative,
  'nom'     => :nominative,
  'род'     => :genitive,
  'gen'     => :genitive,
  'дат'     => :dative,
  'dat'     => :dative,
  'вин'     => :accusative,
  'acc'     => :accusative,
  'твор'    => :instrumental,
  'ins'     => :instrumental,
  'пр'      => :ablative,
  'abl'     => :ablative,
  'парт'    => :partitive,
  'part'    => :partitive,
  'местн'   => :locative,
  'loc'     => :locative,
  'зват'    => :vocative,
  'voc'     => :vocative,
  'ед'      => :singular,
  'sg'      => :singular,
  'мн'      => :plural,
  'pl'      => :plural,
  'деепр'   => :gerund,
  'ger'     => :gerund,
  'инф'     => :infinitive,
  'inf'     => :infinitive,
  'прич'    => :participle,
  'partcp'  => :participle,
  'изъяв'   => :indicative,
  'indic'   => :indicative,
  'пов'     => :imperative,
  'imper'   => :imperative,
  'кр'      => :short,
  'brev'    => :short,
  'полн'    => :full,
  'plen'    => :full,
  'притяж'  => :possessive,
  'poss'    => :possessive,
  'прев'    => :superlative,
  'supr'    => :superlative,
  'срав'    => :comparative,
  'comp'    => :comparative,
  '1-л'     => :person1,
  '1p'      => :person1,
  '2-л'     => :person2,
  '2p'      => :person2,
  '3-л'     => :person3,
  '3p'      => :person3,
  'муж'     => :masculine,
  'm'       => :masculine,
  'жен'     => :feminine,
  'f'       => :feminine,
  'сред'    => :neuter,
  'n'       => :neuter,
  'несов'   => :imperfect,
  'ipf'     => :imperfect,
  'сов'     => :perfect,
  'pf'      => :perfect,
  'действ'  => :active,
  'act'     => :active,
  'страд'   => :passive,
  'pass'    => :passive,
  'од'      => :animated,
  'anim'    => :animated,
  'неод'    => :inanimated,
  'inan'    => :inanimated,
  'пе'      => :transitive,
  'tran'    => :transitive,
  'нп'      => :intransitive,
  'intr'    => :intransitive,
  'вводн'   => :parenth,
  'parenth' => :parenth,
  'гео'     => :geo,
  'geo'     => :geo,
  'затр'    => :awkward,
  'awkw'    => :awkward,
  'имя'     => :first_name,
  'persn'   => :first_name,
  'искаж'   => :distort,
  'dist'    => :distort,
  'мж'      => :mas_fem,
  'mf'      => :mas_fem,
  'обсц'    => :obscene,
  'obsc'    => :obscene,
  'отч'     => :patronymic,
  'patrn'   => :patronymic,
  'прдк'    => :praedic,
  'praed'   => :praedic,
  'разг'    => :informal,
  'inform'  => :informal,
  'редк'    => :rare,
  'rare'    => :rare,
  'сокр'    => :abbreviation,
  'abbr'    => :abbreviation,
  'устар'   => :obsolete,
  'obsol'   => :obsolete,
  'фам'     => :surname,
  'famn'    => :surname
}.freeze

Instance Method Summary collapse

Instance Method Details

#to_msd(grammemes) ⇒ Object

Convert an array with mystem character-based grammemes into an MSD.



129
130
131
132
133
134
# File 'lib/myasorubka/mystem.rb', line 129

def to_msd(grammemes)
  grammemes = grammemes.map { |g| GRAMMEMES[g] }
  grammemes.compact!
  grammemes.map! { |g| Myasorubka::Mystem::Binary::GRAMMEMES.key(g) }
  Myasorubka::Mystem::Binary.to_msd(grammemes)
end