Heuristic
[Ruby][Latin] Forget how to construct your passive voice indicative verbs in Latin? Ruby to rescue.
This started off as a bit of an amusement just to see if i could show the elegance of Ruby – and find a way to help me memorize the suffix-addition-heuristics that characterize inflected languages like Latin.
As usual, it quickly became much more than that.
Known Issue:
The macrons are slightly off, particularly in the 3rd person plural ( no vowel before ’nt’ should ever be lengthened ). I’ll write a fixer routine soon.
[code lang="ruby"] #!/usr/bin/env ruby class Verb < Object attr_reader :firstpersonform, :infinitive, :perfectstem, :passperfpart, :stem def initialize(initString) (@firstpersonform, @infinitive, @perfectstem, @passperfpart)=initString.split(/,\s+/) pparts=initString.split(/,\s+/) @passive_endings = ["r", "ris", "tur", "mur", "min\xc4\xab", "ntur"] @personages = ["First Singular", "Second Singular", "Third Singular", "First Plural", "Second Plural", "Third Plural"] end def stem # For efficiency, if the iVar @stem is defined, don't go # through this structure return @stem unless @stem.