Module: Linguistics::Latin::Phonographia
- Defined in:
- lib/linguistics_latin/phonographia.rb
Overview
The Phonographia module handles the phonography of written Latin: how the sound of Latin is written. In particular, the sounds that need special notation are the vowels which may bear a long ("ā") or short ("a") quantity.
When forming Latin words from heuristic (as LatinVerb does), certain phonographical structures arise that one does not see in the language as practiced by humans. For example, given "amāre," the stem is "amā." When the heuristic postpends "t" to get the present, indicative, third person singular, the result is "amāt," which, by rules of Latin phonology, must be made to bear a short sound in the ultimate vowel. This state is phonographically notes as "amat." This module implements the appropriate rules for proper phonetic compliance.
DESCRIPTION
Latin has several rules pertaining to how long sounds must behave
based on their neighboring characters. The rules that fix_macrons
tests are the following
RULES
Rule 1: :: m/r/t at end of line shortens preceding vowel Rule 2: :: macron-bearing vowel before vowel, regardless of its quantity Rule 3: :: macron-bearing vowel before /n/ anywhere in the string
ARGUMENTS
sa string which needs to be processed for Latin phonographic compliance
RETURNS
String with consonants properly converted
EXAMPLE
fix_macrons(fabām) #=> fabam ( Rule 1 ) fix_macrons(cāīō) #=> caiō ( Rule 1, Rule 2 )
Constant Summary collapse
- MACRON_TABLE =
{ "ā" => 'a', "ē" => 'e', "ī" => 'i', "ō" => 'o', "ū" => 'u', "Ā" => 'A', "Ē" => 'E', "Ī" => 'I', "Ō" => 'O', "Ū" => 'U' }
Class Method Summary collapse
- .fix_macrons(s) ⇒ Object
- .macron_before_nd(s) ⇒ Object
- .macron_before_vowel(s) ⇒ Object
- .mrt_at_end_of_word(s) ⇒ Object
Instance Method Summary collapse
Class Method Details
.fix_macrons(s) ⇒ Object
62 63 64 65 66 67 |
# File 'lib/linguistics_latin/phonographia.rb', line 62 def fix_macrons(s) s = mrt_at_end_of_word(s) s = macron_before_vowel(s) s = macron_before_nd(s) s end |
.macron_before_nd(s) ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/linguistics_latin/phonographia.rb', line 83 def macron_before_nd(s) if s =~ /n[td]/ mutaturum = s.split(//) mutatum = [] mutaturum.each_with_index do |e, i| if ( e == "n" && mutaturum[i+1].match(/[td]/) && !MACRON_TABLE[mutaturum[i-1]].nil? ) mutatum[i-1] = MACRON_TABLE[mutaturum[i-1]] end mutatum << e end return mutatum.join '' end s end |
.macron_before_vowel(s) ⇒ Object
76 77 78 79 80 81 |
# File 'lib/linguistics_latin/phonographia.rb', line 76 def macron_before_vowel(s) if s =~ /(.*)([āēīōūĀĒĪŌŪ])([āēīōūĀĒĪŌŪaeiouAEIOU])(.*)/i return self.fix_macrons $1 + MACRON_TABLE[$2] + $3 + $4 end s end |
.mrt_at_end_of_word(s) ⇒ Object
69 70 71 72 73 74 |
# File 'lib/linguistics_latin/phonographia.rb', line 69 def mrt_at_end_of_word(s) if s =~ /^(.*)([āēīōūĀĒĪŌŪ])([mrt])$/i return $1 + MACRON_TABLE[$2] + $3 end s end |
Instance Method Details
#fix_macrons(s) ⇒ Object
99 100 101 |
# File 'lib/linguistics_latin/phonographia.rb', line 99 def fix_macrons(s) Linguistics::Latin::Phonographia.fix_macrons(s) end |