Class: Word

Inherits:
Object
  • Object
show all
Defined in:
lib/word.rb

Class Method Summary collapse

Class Method Details

.detransliterations_for(word, include_softeners, is_detranslit = true) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/word.rb', line 7

def self.detransliterations_for(word, include_softeners, is_detranslit=true)
  last_part = build_word_part_structure word, is_detranslit
  first_part = add_link_to_succ_to_each_word_part(last_part)
  input_structure = word_input_structure(first_part)
  wps_options = [] #this will be filled with lists of possible cyrillic output (2d-array then)
  part = first_part
  until part.nil? do
    wps_options << part.cyrillic_options(include_softeners)
    part = part.succ
  end
  {:input_structure => input_structure, :options => wps_options}
end

.output_words(part_options) ⇒ Object

transform 2d-options-array two an array of cyrillic words.



25
26
27
28
29
# File 'lib/word.rb', line 25

def self.output_words part_options
  part_options.map!{|a| a.size==0 ? nil : a} #delete empty option arrays
  part_options.compact!
  get_part_combinations '', part_options, []
end

.transliterations_for(word) ⇒ Object



20
21
22
# File 'lib/word.rb', line 20

def self.transliterations_for(word)
  self.detransliterations_for(word, true, false)
end