Class: Linguistics::Latin::Verb::LatinVerb

Inherits:
Object
  • Object
show all
Includes:
Infinitives, Participles, Validation
Defined in:
lib/latinverb.rb,
lib/latinverb/chart.rb,
lib/latinverb/version.rb,
lib/linguistics/latin/verb/supine.rb,
lib/linguistics/latin/verb/constants.rb,
lib/linguistics/latin/verb/latinverb/data.rb,
lib/linguistics/latin/verb/latinverb/display.rb,
lib/linguistics/latin/verb/latinverb/deponent.rb,
lib/linguistics/latin/verb/latinverb/irregular.rb,
lib/linguistics/latin/verb/latinverb/impersonal.rb,
lib/linguistics/latin/verb/latinverb/classmethods.rb,
lib/linguistics/latin/verb/latinverb/semideponent.rb,
lib/linguistics/latin/verb/latinverb/metaprogramming.rb,
lib/linguistics/latin/verb/latinverb/defective_checker.rb,
lib/linguistics/latin/verb/latinverb/latinverb_classifier.rb,
lib/linguistics/latin/verb/latinverb/latinverb_pp_extractor.rb,
lib/linguistics/latin/verb/latinverb/verbvector_description.rb,
lib/linguistics/latin/verb/latinverb/latin_verb_type_evaluator.rb,
lib/linguistics/latin/verb/latinverb/latinverb_input_sanitizer.rb

Overview

:nodoc:

Defined Under Namespace

Modules: DefectiveChecker, Deponent, Impersonal, Irregular, Semideponent Classes: LatinVerbClassifier, LatinVerbInitializationError, LatinVerbInputSanitizer, LatinVerbPPExtractor, LatinVerbTypeEvaluator

Constant Summary collapse

AP_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS =

:stopdoc: active_present_endings: (“ap_”-prefixed)

%w(s  t  mus  tis  nt)
AP_THIRD_CONJUG_PERS_ENDINGS =
%w(ō  is it   imus itis unt)
AP_THIRDIO_CONJG_PERS_ENDINGS =
%w(is it imus itis iunt)
AI_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS =

active_imperfect_endings: (“ai_”-prefixed)

%w(bam bās bat bāmus bātis bant)
AI_THIRD_CONJUG_PERS_ENDINGS =
%w(ēbam ēbās ēbat ēbāmus ēbātis ēbant)
AF_ONE_TWO_ENDINGS =

active_future_endings: (“af_”-prefixed)

%w( bis bit bimus bitis bunt)
AF_OTHER_ENDINGS =
%w(am ēs et ēmus ētis ent)
APERF_ENDINGS =

active_perfect_present: (“aperf”-prefixed)

%w(istī it imus istis ērunt)
APERF_PAST_ENDINGS =
PLUPERF_ENDINGS  =
%w(eram erās erat erāmus erātis erant)
APERF_FUTURE_ENDINGS =
%w(erō eris erit erimus eritis erint)
PASSIVE_ENDINGS_FIRST_AND_SECOND_CONJG =

passive endings

%w(r ris tur mur minī ntur)
PASSIVE_ENDINGS_OTHER =
%w(r eris itur imur iminī untur)
PASS_PERF_PRESENT_ENDINGS =
%w(sum es est sumus estis sunt)
PASS_PERF_PAST_ENDINGS =
%w(eram erās erat erāmus erātis erant)
PASS_PERF_FUTURE_ENDINGS =
%w(erō eris erit erimus eritis erint)
PASS_PERF_SUBJUNCTIVE_ENDINGS =
%w(sim sis sit simus sitis sint)
PASS_PLUPERF_PAST_ENDINGS =
%w(essem essēs esset essēmus essētis essent)
ACTIVE_PRESENT_SUBJUNCTIVE_ENDINGS =

hash for getting a verb’s subjunctive stem based off the W Fr [A] Lr mnemonic

{
  :First   => lambda  { |x| return x + "ē"  },
  :Second  => lambda  { |x| return x + "" },
  :Third   => lambda  { |x| return x + "ā"  },
  :Fourth  => lambda  { |x| return x + "" },
  :ThirdIO => lambda  { |x| return x + "" }
}
DEFECTIVE_VERBS =

Listing of all defective verbs See A&G Sec. 205

%w{
  addormisco
  adolesco
  aio
  albesco
  arboresco
  aresco
  assenesco
  auresco
  candesco
  canesco
  celebresco
  cornesco
  crudesco
  dulcesco
  effor
  erubesco
  extollo
  grandesco
  inquam
  languesco
  latesco
  longisco
  lucesco
  marcesco
  matresco
  mollesco
  remollesco
  siccesco
  sterto
  tenebresco
  tremesco
  tumesco
  veteresco
}
IMPERSONAL_VERBS =

Listing of all impersonal verbs See A&G #207

%w{
  accidit
  addecet
  advesperascit
  certum est
  condecet
  constat
  contingit
  cōnstat
  decet
  dedecet
  dēlecat
  evenit
  fit
  fulgerat
  grandinat
  ifvat
  interest
  licet
  lūcīscit hōc
  miseret
  necesse est
  ningit
  obtingit
  obvenit
  oportet
  paenitet
  piget
  placet
  pluit
  pluo
  praestat
  pudet
  restat
  rēfert
  rōrat
  superest
  taedet
  tonat
  vacat
  vesperāscit
  vidētur
  ēvenit
}
PRESENT_ONLY =

Present system only. See A&G206 There are probably more of these, but A&G only lists these two.

%w{
  maēre
  ferīre
  aiō
  inquam
  for
  quaesō
  ovāre
}
SEMI_DEPONENTS =

See A&G # 192

{
  'audeō'  => %w(audēre ausus),
  'fidō'   => %w(fidere fīsus),
  'gaudeō' => %w(gaudēre gāvīsus),
  'soleō'  => %w(solēre solitus),
}
IRREGULAR_VERBS =

Irregular Verbs. See A&G 197

{
  'sum'    => 'SUM_ESSE_FUĪ_FUTŪRUS',
  'possum' => 'POSSUM_POSSE_POTUĪ',
  'ferō'   => 'FERŌ_FERRE_TULĪ_LĀTUM',
  ''     => 'EŌ_ĪRE_IVĪ_ITUM',
  'nōlō'   => 'NŌLŌ_NŌLLE_NŌLUĪ',
  'volō'   => 'VOLŌ_VELLE_VOLUĪ',
  'mālō'   => 'MĀLŌ_MĀLLE_MĀLUĪ',
  ''     => 'DŌ_DĀRE_DEDĪ_DATUM',
  'edō'    => 'EDŌ_ĒSSE_ĒDĪ_ĒSUM',
  'queō'   => 'QUEŌ_QUĪRE_QUĪVĪ',
  'fiō'    => 'FIŌ_FIĒRĪ_FACTUS',
  'prōsum' => 'PRŌSUM_PRŌDESSE_PRŌFUĪ_PRŌFUTŪRUS',
  'meminī' => 'MEMINĪ_MEMINISSE',
  'ōdī'    => 'ODĪ_ŌDISSE',
  'coepī'  => 'COEPĪ_COEPISSE_COEPTUM'
}
MEANINGS =
{
  :active_voice_imperative_mood_future_tense => "Command that something be done in the future",
  :active_voice_indicative_mood_future_tense=> "Action to take place in the future: 'I will eat a hamburger.'" ,
  :active_voice_indicative_mood_futureperfect_tense => "Action to be completed in the future: 'I will have eaten a hamburger.'" ,
  :active_voice_indicative_mood_imperfect_tense => "Sustained, habitual action in the past:  'I was eating hamburgers daily when I was a freshman.'" ,
  :active_voice_indicative_mood_pastperfect_tense => "Action completed prior to a point in the past under discussion: 'I had eaten all the hamburgers (before my mother found out).'" ,
  :active_voice_indicative_mood_perfect_tense => "Action completed in the past: 'I ate a hamburger.'" ,
  :active_voice_indicative_mood_present_tense => "Present, possibly ongoing action relative to the speaker: 'I am eating a hamburger.  I eat a hamburger.'" ,
  :active_voice_subjunctive_mood_imperfect_tense => "Subjunctive uses apply: commands, contrary to fact wishes, etc." ,
  :active_voice_subjunctive_mood_pastperfect_tense => "Subjunctive uses apply: commands, contrary to fact wishes, etc." ,
  :active_voice_subjunctive_mood_perfect_tense => "Subjunctive uses apply: commands, contrary to fact wishes, etc." ,
  :active_voice_subjunctive_mood_present_tense => "Subjunctive uses apply: commands, contrary to fact wishes, etc." ,
  :passive_voice_indicative_mood_future_tense => "Action to be performed on conjugant in future:  'The hamburger will be eaten.'" ,
  :passive_voice_indicative_mood_futureperfect_tense => "Action is to be performed to completion on conjugant in future: 'The hamburger will have been eaten.'" ,
  :passive_voice_indicative_mood_imperfect_tense => "Habitual action performed on the conjugant in the past: 'The hamburger was being eaten slowly by the BurgerHoarder.'" ,
  :passive_voice_indicative_mood_pastperfect_tense => "Action was fully completed upon the conjugant at a time prior to a time in the past: 'The hamburger had been eaten before my mom came home.'" ,
  :passive_voice_indicative_mood_perfect_tense => "Action was completed upon the conjugant in the past: 'The hamburger was eaten.'" ,
  :passive_voice_indicative_mood_present_tense => "Conjugant is presently undergoing action in the present time: 'The hamburger is being eaten.'" ,
  :passive_voice_subjunctive_mood_imperfect_tense => "Subjunctive uses apply: commands, contrary to fact wishes, etc." ,
  :passive_voice_subjunctive_mood_pastperfect_tense => "Subjunctive uses apply: commands, contrary to fact wishes, etc." ,
  :passive_voice_subjunctive_mood_perfect_tense => "Subjunctive uses apply: commands, contrary to fact wishes, etc." ,
  :passive_voice_subjunctive_mood_present_tense => "Subjunctive uses apply: commands, contrary to fact wishes, etc."
}
LATIN_VERBVECTOR_DESCRIPTION =
Proc.new do
  language :Latin do
    all_vectors :start_with do
       {
        :voice =>  %w(active passive),
        :mood  =>  %w(indicative subjunctive imperative)
       }
    end
    vectors_that(/.*_indicative_mood/) do
      {
        :tense  => %w(present imperfect future
                      perfect pastperfect futureperfect)
      }
    end
    vectors_that(/.*_subjunctive_mood/) do
      {
        :tense => %w(present imperfect
                      perfect pastperfect)
      }
    end
    vectors_that(/.*_imperative_mood/) do
      {
        :tense => %w(present future)
      }
    end
    all_vectors :end_with do
      {
        :person => %w(first second third),
        :number => %w(singular plural)
      }
    end
    exception :remove, :passive_voice_imperative_mood_present_tense
    exception :remove, :passive_voice_imperative_mood_future_tense
    cluster_on :tense, "as method", :tense_list
  end
end

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Infinitives

#future_active_infinitive, #future_passive_infinitive, #infinitives, #perfect_active_infinitive, #perfect_passive_infinitive, #present_passive_infinitive

Methods included from Participles

#future_active_participle, #future_passive_participle, #gerund, #gerundive, #perfect_passive_participle, #present_active_participle

Methods included from Validation

#valid?

Constructor Details

#initialize(data) ⇒ LatinVerb

The constructor for a Latinverb

ARGUMENTS

s:

s is class-tested and supports String or Hash classes,

with the standard path having been designed to accept a string containing 4 words (“four principal parts”). Latin’s principal irregular verbs are also accepted (see CONSTANTS) as possible entries. s also accepts a Hash as input. This is used for deserialization from JSON which initialized based on a Hash.

SEE ALSO

#initialize does very little work. Therefore special attention should be paid to the #_init_by_string and _add_vector_methods. These are the workhorses of this class and do most of the decoration activity. In the case of extending to support irregular verbs, #_irregular_handler is a critical path to explore.

TODO

  • Array support for the argument

}}



214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
# File 'lib/latinverb.rb', line 214

def initialize(data)# {{{
  raise LatinVerbInitializationError if data.nil?

  ### {{{
  # Generates all the methods to which a verb must be able to respond
  # by implementing Linguistics::Verbs::Verbvector::VerbvectorGenerator.
  #
  # This conforms to the definition provided in Allen & Greenough Sec.
  # 154:
  #
  #    Through its conjugation the Verb expresses Voice, Mood, Tense
  #    Person, and Number.
  #
  #    a.  The Voices are two:  Active and Passive
  #    b. The Moods are four: Indicative,Subjuncitve, Imperative, and
  #    Infinitive
  #
  #    ...
  #
  #    c.  The Tenses are six, viz: --
  #    1.  For continued action:  Present, Imperfect, Future
  #    2.  For completed action, Perfect, Pluperfect, Future Perfect
  #
  #    The Indicative Mood has all six tenses, but the Subjunctive has
  #    no future or future perfect and the Imperative has only the
  #    present and the future.  The Infinitive has the present, perfect,
  #    and future.
  #
  #    d. The Persons are three:  First, Secon, Third.
  #    e.  The Numbers are two:  Singular and Plural
  ### }}}
  @latin_verbvector_generator =
    Linguistics::Verbs::Verbvector::VerbvectorGenerator.new(
      &Linguistics::Latin::Verb::LatinVerb::LATIN_VERBVECTOR_DESCRIPTION )

  # We're restoring a standard verb from JSON
  data = data['original_string'] if init_data_is_a_hash_of_a_regular_restorable_verb(data)

  if data.is_a? String
    @sanitizer            = LatinVerbInputSanitizer.new data
    @original_string      = @sanitizer.to_s
    @classifier           = LatinVerbClassifier.new @original_string
    @prin_parts_extractor = LatinVerbPPExtractor.new @sanitizer.to_s, @classifier
    @verb_type            = LatinVerbTypeEvaluator.new first_person_singular, present_active_infinitive, @classifier

    load_tense_methods
    generate_methods_for_accessing_tense_blocks_from_tense_methods_components
    include_classification_specific_mixins
    check_and_mutate_defectives
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args) ⇒ Object

DESCRIPTION

Override of the method_missing method. A lot of the magic of LatinVerb happens here. This method has deep interactoion with the Verbvector results called as part of the LatinVerb.initialize call path.

INTERNALS

Given a symbol that is undefined, we look to @tense_list first. The typical case would be a call on a 3/5ths vector identification. Therefore if the call is pure nonsense, the symbol will not be found on the first evaluation and go to super. Assuming that the symbol IS a partial vector call, it will match through the iteration of the values in @tense_list. Based on the match, two Regexp values are derived:

  • the first 3/5ths (enough to get a TenseBlock), called a tense_method

  • the last 2/5ths (enough to specify a value out of that TenseBlock), called a vector_specifier

Given those two names, the tense_method is called on the LatinVerb with send and that resultant value, a TenseBlock, undergoes a send call to the specifier, thus all 5/5 components of the fully-qualified vector can result in unique match.

Raises:

  • (RuntimeError)


39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/linguistics/latin/verb/latinverb/metaprogramming.rb', line 39

def method_missing(method_name, *args )  # :nodoc:
  method_name_components = method_name.to_s.split('_')

  tense_method = Array(method_name_components[0..5]).join('_')
  vector_specifier = Array(method_name_components[6..-1]).join('_')

  raise RuntimeError, "Lookup on #{method_name} failed" if tense_method.nil? || vector_specifier.nil?

  if self.respond_to?(tense_method.to_sym)
    tense_block = send(tense_method.to_sym)
    raise RuntimeError, "Call for #{tense_method} failed" if tense_block.nil?
    tense_block.send(vector_specifier.to_sym)
  else
    super
  end
end

Instance Attribute Details

#latin_verb_methodsObject (readonly)

Access the Module that provides all the methods



185
186
187
# File 'lib/latinverb.rb', line 185

def latin_verb_methods
  @latin_verb_methods
end

#latin_verbvector_generatorObject (readonly)

Access the Module that provides all the methods



185
186
187
# File 'lib/latinverb.rb', line 185

def latin_verbvector_generator
  @latin_verbvector_generator
end

#original_stringObject (readonly)

Attributes for storing submitted data. This will help remember the origin state# {{{



179
180
181
# File 'lib/latinverb.rb', line 179

def original_string
  @original_string
end

#verb_methodsObject (readonly)

Attributes for storing calculated status.



182
183
184
# File 'lib/latinverb.rb', line 182

def verb_methods
  @verb_methods
end

Class Method Details

.calculate_participial_stem(first_person_singular, present_active_infinitive) ⇒ Object

ARGUMENTS

* first_person_singular
* present_active_infinitive

RETURNS

The participial “stem” of a Latin Verb, used for participle formation

PURPOSE

Calculate the participial stem, used in forming participles.



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/linguistics/latin/verb/latinverb/classmethods.rb', line 103

def calculate_participial_stem(first_person_singular, present_active_infinitive)
   raise("present_active_infinitive was nil![#{first_person_singular} and #{present_active_infinitive}]") if
     present_active_infinitive.empty? or first_person_singular.empty?

   if present_active_infinitive.to_s =~ /(.*ā)re$/
    return $1
  end

  if present_active_infinitive.to_s =~ /(.*ē)re$/
    return $1
  end

  if present_active_infinitive.to_s =~ /(.*)ere$/
    match=$1
    if first_person_singular =~ //
      return match + ""
    else
      return match + "e"
    end
  end

  if present_active_infinitive.to_s =~ /(.*)īre$/
    return $1 + ""
  end
end

.create_pseudo_active_mask_for_deponent(s) ⇒ Object

Deponent verbs can be conceived as being the the passive results of a regular verb where the passive form’s result is then applied to the active vector specification. Ergo the dictum “passive in form but active in meaning.” As such, when we realize we have a deponent verb, we will create its standard four principal part string sibling. This, in turn, could be used to create a LatinVerb. Then through some method deletion or aliasing, the active vector can be used to point to the (in fact) passive result

For example:

<pre> j = LatinVerb.new conor conārī conatus # create_pseudo_active_mask_for_deponent creates (conō, conāre, conāvī conatus) # Do magic so that active_voice_indicative_mood_present_tense points to passive_voice_indicative_mood_present_tense </pre>

ARGUMENTS

s

A deponent description string to be pesudo-mapped

RETURNS

A pseudo-mapped, four principal-part string



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/linguistics/latin/verb/latinverb/classmethods.rb', line 39

def create_pseudo_active_mask_for_deponent(s)
  parts = s.split( /\s+/ )

  # Turn the passive form into something that looks active
  parts[0].sub!( /or$/, 'ō' )

  # Turn the passive infinitive into something that looks active.
  # There's a subtle difference between:
  # 'vereor verērī veritum'
  # 'sequor sequī secūtus'
  #  Applying the first's rule to the second results in 'seque' not
  #  'sequere'.  Ergo the conditional.
  #
  parts[1].sub!( /ī$/, 'e' )

  # Fixes sequī -> sequere
  parts[1] += 're' unless parts[1] =~ /[āīē]re/

  # Set the 4th part to the value in the 3rd slot
  parts[3] = parts[2]

  # Another modification for third conjugation deponents
  parts[3].sub!( /us$/, 'um' )

  # This value shouldn't be used
  parts[2] = "PreventDeponentInfiniteRegress"

  parts.join(' ')
end

.json_create(o) ⇒ Object

Required method for JSON deserialization



11
12
13
# File 'lib/linguistics/latin/verb/latinverb/data.rb', line 11

def self.json_create(o)
  new( o )
end

Instance Method Details

#c_prep(heading, rays, subtitles, format_string) ⇒ Object



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

def c_prep(heading, rays, subtitles, format_string)
  puts heading
  puts '=' * heading.length + "\n"
  printf format_string, '', *subtitles
  underbars = subtitles.clone
  underbars.map!{|j| j.gsub! /./, '='}
  printf format_string, '', *underbars
  vertical_transform({
    :label => ['1st Sg.', '2nd Sg.', '3rd Sg.','1st Pl.', '2nd Pl.', '3rd Pl.'],
    :rays  => rays
  }).each{|a| printf format_string, *a}
end

#chartObject Also known as: c



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/latinverb/chart.rb', line 19

def chart
  f="%9s%15s%15s%15s\n"
  f_subjunctive="%9s%15s%15s%15s%15s\n"
  c_prep "Present System", [
                            self.active_voice_indicative_mood_present_tense,
                            self.active_voice_indicative_mood_imperfect_tense,
                            self.active_voice_indicative_mood_future_tense
                           ], %w/Present Imperfect Future/,f
  puts "\n"
  c_prep "Perfect System", [ self.active_voice_indicative_mood_perfect_tense,
                             self.active_voice_indicative_mood_pastperfect_tense,
                             self.active_voice_indicative_mood_futureperfect_tense
                           ], %w/Perfect Past-Perfect Future-Perfect/,f
  puts "\n"
  c_prep "Passive Present System", [
                                    self.passive_voice_indicative_mood_present_tense,
                                    self.passive_voice_indicative_mood_imperfect_tense,
                                    self.passive_voice_indicative_mood_future_tense
                                   ], %w/Present Imperfect Future/,f
  puts "\n"
  c_prep "Passive Perfect System", [ self.passive_voice_indicative_mood_perfect_tense,
                                     self.passive_voice_indicative_mood_pastperfect_tense,
                                     self.passive_voice_indicative_mood_futureperfect_tense
                                   ], %w/Perfect Past-Perfect Future-Perfect/,f
  puts "\n"


  c_prep "Subjunctives", [ self.active_voice_subjunctive_mood_present_tense,
                           self.active_voice_subjunctive_mood_imperfect_tense,
                           self.active_voice_subjunctive_mood_perfect_tense,
                           self.active_voice_subjunctive_mood_pastperfect_tense
                         ], %w/Present Imperfect Perfect Past-Perfect/,f_subjunctive
  puts "\n"
  c_prep "Passive Subjunctives", [ self.active_voice_subjunctive_mood_present_tense,
                                   self.active_voice_subjunctive_mood_imperfect_tense,
                                   self.active_voice_subjunctive_mood_perfect_tense,
                                   self.active_voice_subjunctive_mood_pastperfect_tense
                                 ], %w/Present Imperfect Perfect Past-Perfect/,f_subjunctive
  puts "\n"
  puts "Participles"
  self.methods.grep(/_participle$/).each do |p|
    printf "%42s %42s\n", p.to_s.gsub('_', ' ').gsub(/\b\w/){$&.upcase}, self.send(p)
  end
  puts "\n"
  puts "Infinitives"
  self.methods.grep(/infinitive$/).each do |p|
    printf "%42s %42s\n", (p.to_s.gsub('_', ' ').gsub(/\b\w/){$&.upcase}), self.send(p)
  end
  return nil
end

#classificationObject

}}}



302
303
304
# File 'lib/latinverb.rb', line 302

def classification# {{{
  @classifier.classification
end

#classified_asObject

}}}



324
325
326
# File 'lib/latinverb.rb', line 324

def classified_as# {{{
  return @classifier
end

#conjugationObject

}}}



316
317
318
# File 'lib/latinverb.rb', line 316

def conjugation# {{{
  classification.to_s
end

#displayObject

You should not be using this, probably

This is a a convenience method so that you can print out the contents in a human-readable fashion. LatinVerb is a library that _should be implemented elsewhere_ where its results can be presented by more view-oriented libraries or applications.



15
16
17
18
# File 'lib/linguistics/latin/verb/latinverb/display.rb', line 15

def display
  STDERR.puts "You should not be doing much displaying here as this is a LIBRARY.  Implement this elsewhere."
  pretty_generate
end

#first_person_perfectObject

}}}



336
337
338
# File 'lib/latinverb.rb', line 336

def first_person_perfect# {{{
  @first_person_perfect ||= @prin_parts_extractor.first_person_perfect
end

#first_person_singularObject

}}}



328
329
330
# File 'lib/latinverb.rb', line 328

def first_person_singular# {{{
  @first_person_singular ||= @prin_parts_extractor.first_person_singular
end

#instance_methodsObject

When working in irb or LatinIRB it’s good to find out what the instance methods are on this# }}



290
291
292
# File 'lib/latinverb.rb', line 290

def instance_methods# {{{
  @latin_verbvector_generator.vector_list
end

#irregular?Boolean

}}}

Returns:

  • (Boolean)


298
299
300
# File 'lib/latinverb.rb', line 298

def irregular?# {{{
  @classifier.irregular?
end

#participial_stemObject

}}}



344
345
346
# File 'lib/latinverb.rb', line 344

def participial_stem# {{{
  @participial_stem ||= @prin_parts_extractor.participial_stem
end

#passive_perfect_participleObject

}}}



340
341
342
# File 'lib/latinverb.rb', line 340

def passive_perfect_participle# {{{
  @passive_perfect_participle ||= @prin_parts_extractor.passive_perfect_participle
end

#present_active_infinitiveObject

}}}



332
333
334
# File 'lib/latinverb.rb', line 332

def present_active_infinitive# {{{
  @present_active_infinitive ||= @prin_parts_extractor.present_active_infinitive
end

#present_only?Boolean

Instance methods

Returns:

  • (Boolean)


271
272
273
# File 'lib/latinverb.rb', line 271

def present_only?# {{{
  @present_only ||= @classifier.present_only?
end

#pretty_generateObject

Dumps the LatinVerb as pretty JSON



80
81
82
# File 'lib/linguistics/latin/verb/latinverb/data.rb', line 80

def pretty_generate
  JSON.pretty_generate( self.to_h )
end

#principal_partsObject

}}}



320
321
322
# File 'lib/latinverb.rb', line 320

def principal_parts# {{{
  @principal_parts ||= @prin_parts_extractor.principal_parts
end

#regular?Boolean

}}}

Returns:

  • (Boolean)


294
295
296
# File 'lib/latinverb.rb', line 294

def regular?# {{{
  @classifier.regular?
end

#respond_to_missing?(method_name, include_private = false) ⇒ Boolean

We override respond_to so that we respond to the normal object models as well as accept the method_missing utilized names as well. If it’s in respondable_methods, we return true.

Returns:

  • (Boolean)


63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/linguistics/latin/verb/latinverb/metaprogramming.rb', line 63

def respond_to_missing?(method_name, include_private = false) #:nodoc:
  components     = method_name.to_s.split('_')
  tense_method   = components[0..5].join('_').to_sym

  return false unless @tense_list.nil? || @tense_list.include?( tense_method.to_s )

  if components.length > 6
    tb           = self.send(tense_method)
    vector_call  = components[6..-1].join('_').to_sym
    tb.class.instance_method(vector_call)
  end

end

#short_classObject

}}}



274
275
276
# File 'lib/latinverb.rb', line 274

def short_class# {{{
  return classification.to_s.gsub(/.*::(\w+)$/,"\\1")
end

#stemObject

}}}



310
311
312
313
314
# File 'lib/latinverb.rb', line 310

def stem# {{{
  unless classified_as.irregular?
    @stem ||= @prin_parts_extractor.stem
  end
end

#supineObject

GRAMMATICAL FUNCTION

The supine is:

* 4th declension verbal noun
* Formed on the same stem as the perfect passive participle
* Only two forms in common use:  accusative and ablative singular

Ablative is used with the neuter of certain adjectives to indicate what respect a particular quality is applicable: mirabile dictu, facile factu. The accusative is used with verbs of motion to indicate purpose.

– Source Wheelock

ARGUMENTS

None

RETURNS

Hash with keys based on [:accusative] or [:ablative]



33
34
35
36
37
38
# File 'lib/linguistics/latin/verb/supine.rb', line 33

def supine
  acc = passive_perfect_participle
  abl = acc.sub( /^(.*)um$/, "\\1" )
  abl += "ū"
  {:ablative => abl, :accusative => acc}
end

#to_aObject



100
101
102
# File 'lib/linguistics/latin/verb/latinverb/latinverb_pp_extractor.rb', line 100

def to_a
  @principal_parts
end

#to_hashObject Also known as: to_h

Presents the LatinVerb expressed as a hash with the names of the TenseBlock specifiers as keys, and corresponding TenseBlock objects, converted to Arrays, as the values. It also contains the original_string.



22
23
24
25
26
27
28
29
30
# File 'lib/linguistics/latin/verb/latinverb/data.rb', line 22

def to_hash
  data_structure = {}
  @tense_list.each do |t|
    ts = t.to_sym
    data_structure[ts]=self.send ts
  end
  data_structure['original_string'] = @original_string
  return data_structure
end

#to_json(*a) ⇒ Object

Required method for JSON deserialization



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/linguistics/latin/verb/latinverb/data.rb', line 51

def to_json(*a)
  json_hash = {'json_class' => self.class.name}

  # In the case that we're working with a regular verb, the only thing
  # we need to save is the original string, since everything can be
  # re-derived from it easily.
  unless self.irregular?
    # While this single string is sufficient to freeze and revivifty
    # the verb, it means that the JSON structure is rather vacuous.
    # Given this, the hash is enriched so that the JSON data is
    # useful.  Nevertheless, in the revivification process, only
    # 'orig_string' is used.
    %w{original_string classification stem}.each do |k|
      json_hash[k] = self.send k.to_sym
    end
    json_hash['tense_list' ]  = {}
    @tense_list.each do |t|
      json_hash['tense_list'][t.to_s] = self.send t.to_sym
    end
    json_hash['irregular']    = irregular?
    return json_hash.to_json(*a)
  end
end

#to_sObject

Returns the four principal parts and regularity designation }}



282
283
284
# File 'lib/latinverb.rb', line 282

def to_s# {{{
  return sprintf("%s [%s]", short_class, original_string)
end

#to_yamlObject Also known as: to_y

Takes the hash that results from to_hash and then converts it to YAML.



40
41
42
# File 'lib/linguistics/latin/verb/latinverb/data.rb', line 40

def to_yaml
  to_hash.to_yaml
end

#verb_typeObject

}}}



306
307
308
# File 'lib/latinverb.rb', line 306

def verb_type# {{{
  @verb_type.inspect
end

#vertical_transform(opts = nil) ⇒ Object



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/latinverb/chart.rb', line 72

def vertical_transform( opts = nil )
  # Get the length of the first array to be verticalized
  length = opts[:rays][0].length-1

  # Storage
  returnTemp = []

  # Verticalize
  0.upto(length).each do |n|
    temp = []
    temp << opts[:label][n] unless opts[:label].empty?
    opts[:rays].collect do |r|
      temp << r[n]
    end
    returnTemp << temp
  end

  returnTemp
end