Class: Iev::TermAttrsParser

Inherits:
Object
  • Object
show all
Includes:
Cli::Ui
Defined in:
lib/iev/term_attrs_parser.rb

Overview

Parses information from the spreadsheet’s TERMATTRIBUTE column and alike.

Examples:

parser = TermAttrsParser.new(cell_data_string)
parser.gender # returns grammatical gender
parser.plurality # returns grammatical plurality
parser.part_of_speech # returns part of speech

Constant Summary collapse

PARTS_OF_SPEECH =
{
  "adj" => "adj",
  "noun" => "noun",
  "verb" => "verb",
  "名詞" => "noun",
  "動詞" => "verb",
  "形容詞" => "adj",
  "형용사" => "adj",
  "Adjektiv" => "adj",
}.freeze
PREFIX_KEYWORDS =
%w[
  Präfix prefix préfixe 接尾語 접두사 przedrostek prefixo 词头
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Cli::Ui

debug, info, progress, set_ui_tag, warn

Constructor Details

#initialize(attr_str) ⇒ TermAttrsParser

Returns a new instance of TermAttrsParser.



37
38
39
40
41
# File 'lib/iev/term_attrs_parser.rb', line 37

def initialize(attr_str)
  @raw_str = attr_str.dup.freeze
  @src_str = decode_attrs_string(raw_str).freeze
  parse
end

Instance Attribute Details

#genderObject (readonly)

Returns the value of attribute gender.



19
20
21
# File 'lib/iev/term_attrs_parser.rb', line 19

def gender
  @gender
end

#geographical_areaObject (readonly)

Returns the value of attribute geographical_area.



19
20
21
# File 'lib/iev/term_attrs_parser.rb', line 19

def geographical_area
  @geographical_area
end

#part_of_speechObject (readonly)

Returns the value of attribute part_of_speech.



19
20
21
# File 'lib/iev/term_attrs_parser.rb', line 19

def part_of_speech
  @part_of_speech
end

#pluralityObject (readonly)

Returns the value of attribute plurality.



19
20
21
# File 'lib/iev/term_attrs_parser.rb', line 19

def plurality
  @plurality
end

#prefixObject (readonly)

Returns the value of attribute prefix.



19
20
21
# File 'lib/iev/term_attrs_parser.rb', line 19

def prefix
  @prefix
end

#raw_strObject (readonly)

Returns the value of attribute raw_str.



19
20
21
# File 'lib/iev/term_attrs_parser.rb', line 19

def raw_str
  @raw_str
end

#src_strObject (readonly)

Returns the value of attribute src_str.



19
20
21
# File 'lib/iev/term_attrs_parser.rb', line 19

def src_str
  @src_str
end

#usage_infoObject (readonly)

Returns the value of attribute usage_info.



19
20
21
# File 'lib/iev/term_attrs_parser.rb', line 19

def usage_info
  @usage_info
end

Instance Method Details

#inspectObject



43
44
45
# File 'lib/iev/term_attrs_parser.rb', line 43

def inspect
  "<ATTRIBUTES: #{src_str}>".freeze
end