Module: Hierogloss::Dictionary

Defined in:
lib/hierogloss/dictionary.rb

Overview

:nodoc: Internal dictionary-related utilities. APIs are not stable.

Constant Summary collapse

DATA_DIR =
File.join(File.dirname(__FILE__), '..', '..', 'data')
MDC_MAPPING_PATH =
File.join(DATA_DIR, "Unicode-MdC-Mapping-v1.utf8")
SIGN_TO_GARDINER =
{}
MDC_TO_SIGN =
{}
SIGN_TO_MDC =
{}

Class Method Summary collapse

Class Method Details

.headword(word) ⇒ Object

Try to kick things into shape for hierogl.ch.



31
32
33
34
35
36
37
38
# File 'lib/hierogloss/dictionary.rb', line 31

def headword(word)
  hw = word
  hw.gsub!(/[()]/, '')
  hw.sub!(/=.*\z/, '')
  hw.sub!(/\.w?t\z/, 't')
  hw.sub!(/\..*\z/, '')
  hw
end

.mdc_to_sign(mdc) ⇒ Object

Convert a Manuel de Codage transliteration to the corresponding Unicode sign.



47
48
49
# File 'lib/hierogloss/dictionary.rb', line 47

def mdc_to_sign(mdc)
  MDC_TO_SIGN[mdc]
end

.sign_to_gardiner(sign) ⇒ Object

Given a Unicode hieroglyph, get the corresponding Gardiner sign.



41
42
43
# File 'lib/hierogloss/dictionary.rb', line 41

def sign_to_gardiner(sign)
  SIGN_TO_GARDINER[sign]
end

.sign_to_mdc(sign) ⇒ Object

Convert a Unicode hieroglyph to a reasonable MdC representation.



52
53
54
# File 'lib/hierogloss/dictionary.rb', line 52

def sign_to_mdc(sign)
  SIGN_TO_MDC[sign]
end