def conjugate verb
      @current_el = @data.at_xpath "/verbs/verb[@word='#{verb}']"
      @current_el = get_fallback_for_verb(verb) if @current_el.nil?
      return false if @current_el.nil?
      
      ret = {}
      @current_el_parents = [] # array of parents of the element, sorted by priority - parents earlier in the array will be picked over later ones
      store_parents @current_el # populate the parents array
      
      group = nil; group_search = nil
      forms.each do |form|
        next if @forms_except.include?(form)
        ret[form] = {}
        
        group_search = "group[@id='#{form}']"
        group = search_current_el group_search
        
        # grab modifier elements and extract their values
        group_prepend_el = group.at_xpath('prepend'); group_append_el = group.at_xpath('append'); group_mod_el = group.at_xpath('mod'); group_endlength_el = group.at_xpath('endlength')
        group_prepend = group_prepend_el.nil? ? nil : group_prepend_el.text
        group_append = group_append_el.nil? ? nil : group_append_el.text
        group_mod = group_mod_el.nil? ? nil : {:match => group_mod_el['match'], :search => group_mod_el['search'], :replace => group_mod_el['replace']}
        group_endlength = group_endlength_el.nil? ? nil : group_endlength_el.text.to_i
        
        pdgmgroup = nil; pdgmgroup_search = nil
        paradigm = nil; paradigm_search = nil
        paradigms.each do |paradigm|
          next if @paradigms_except.include?(paradigm)

          pdgmgroup_search = "group[@id='#{form}']/pdgmgroup[@id='#{paradigm[:person]}']"
          pdgmgroup = search_current_el pdgmgroup_search
          
          # skip this paradigm group if the "ignore" attribute is set
          next unless pdgmgroup['ignore'].nil?
          
          # grab modifier elements and extract their values
          # if unset, try to inherit from parent group
          pdgmgroup_prepend_el = pdgmgroup.at_xpath('prepend'); pdgmgroup_append_el = pdgmgroup.at_xpath('append'); pdgmgroup_mod_el = pdgmgroup.at_xpath('mod'); pdgmgroup_endlength_el = pdgmgroup.at_xpath('endlength')
          pdgmgroup_prepend = pdgmgroup_prepend_el.nil? ? group_prepend : pdgmgroup_prepend_el.text
          pdgmgroup_append = pdgmgroup_append_el.nil? ? group_append : pdgmgroup_append_el.text
          pdgmgroup_mod = pdgmgroup_mod_el.nil? ? group_mod : {:match => pdgmgroup_mod_el['match'], :search => pdgmgroup_mod_el['search'], :replace => pdgmgroup_mod_el['replace']}
          pdgmgroup_endlength = pdgmgroup_endlength_el.nil? ? group_endlength : pdgmgroup_endlength_el.text.to_i
          
          paradigm_search = "group[@id='#{form}']/pdgmgroup[@id='#{paradigm[:person]}']/paradigm[@id='#{paradigm[:quant]}']"
          paradigm_el = search_current_el paradigm_search
          
          # skip this paradigm if the "ignore" attribute is set
          next unless paradigm_el['ignore'].nil?
          
          # grab modifier elements and extract their values
          # if unset, try to inherit from parent paradigm group
          paradigm_prepend_el = paradigm_el.at_xpath('prepend'); paradigm_append_el = paradigm_el.at_xpath('append'); paradigm_mod_el = paradigm_el.at_xpath('mod'); paradigm_endlength_el = paradigm_el.at_xpath('endlength')
          prepend = paradigm_prepend_el.nil? ? pdgmgroup_prepend : paradigm_prepend_el.text
          append = paradigm_append_el.nil? ? pdgmgroup_append : paradigm_append_el.text
          mod = paradigm_mod_el.nil? ? pdgmgroup_mod : {:match => paradigm_mod_el['match'], :search => paradigm_mod_el['search'], :replace => paradigm_mod_el['replace']}
          
          endlength = paradigm_endlength_el.nil? ? pdgmgroup_endlength : paradigm_endlength_el.text.to_i
          endlength = 0 if endlength.nil? or endlength < 0
          
          # make a copy of verb to run the modifiers on
          modded_verb = verb
          
          # chop n chars from the end of the string, based on the <endlength> modifier
          modded_verb = modded_verb[0 ... ( modded_verb.length - endlength )] unless endlength.nil?
          
          # <mod> modifier (regex replacement)
          unless mod.nil?
            case mod[:match]
            when 'first' then modded_verb.sub!(mod[:search], mod[:replace])
            when 'last' then modded_verb.sub!(/(.*)#{mod[:search]}(.*)/, "\1#{mod[:replace]}\3")
            when 'all' then modded_verb.gsub!(mod[:search], mod[:replace])
            end
          end
          
          # <append> and <prepend> modifiers
          modded_verb = ( prepend.nil? ? '' : prepend ) + modded_verb + ( append.nil? ? '' : append )
          ret[form][paradigm[:person] + paradigm[:quant]] = modded_verb
        end
      end
      
      @current_el = nil
      @current_el_inheritor = nil
      
      ret
    end
def conjugate verb
      @current_el = @data.at_xpath "/verbs/verb[@word='#{verb}']"
      @current_el = get_fallback_for_verb(verb) if @current_el.nil?
      return false if @current_el.nil?
      
      ret = {}
      @current_el_parents = [] # array of parents of the element, sorted by priority - parents earlier in the array will be picked over later ones
      store_parents @current_el # populate the parents array
      
      group = nil; group_search = nil
      forms.each do |form|
        next if @forms_except.include?(form)
        ret[form] = {}
        
        group_search = "group[@id='#{form}']"
        group = search_current_el group_search
        
        # grab modifier elements and extract their values
        group_prepend_el = group.at_xpath('prepend'); group_append_el = group.at_xpath('append'); group_mod_el = group.at_xpath('mod'); group_endlength_el = group.at_xpath('endlength')
        group_prepend = group_prepend_el.nil? ? nil : group_prepend_el.text
        group_append = group_append_el.nil? ? nil : group_append_el.text
        group_mod = group_mod_el.nil? ? nil : {:match => group_mod_el['match'], :search => group_mod_el['search'], :replace => group_mod_el['replace']}
        group_endlength = group_endlength_el.nil? ? nil : group_endlength_el.text.to_i
        
        pdgmgroup = nil; pdgmgroup_search = nil
        paradigm = nil; paradigm_search = nil
        paradigms.each do |paradigm|
          next if @paradigms_except.include?(paradigm)

          pdgmgroup_search = "group[@id='#{form}']/pdgmgroup[@id='#{paradigm[:person]}']"
          pdgmgroup = search_current_el pdgmgroup_search
          
          # skip this paradigm group if the "ignore" attribute is set
          next unless pdgmgroup['ignore'].nil?
          
          # grab modifier elements and extract their values
          # if unset, try to inherit from parent group
          pdgmgroup_prepend_el = pdgmgroup.at_xpath('prepend'); pdgmgroup_append_el = pdgmgroup.at_xpath('append'); pdgmgroup_mod_el = pdgmgroup.at_xpath('mod'); pdgmgroup_endlength_el = pdgmgroup.at_xpath('endlength')
          pdgmgroup_prepend = pdgmgroup_prepend_el.nil? ? group_prepend : pdgmgroup_prepend_el.text
          pdgmgroup_append = pdgmgroup_append_el.nil? ? group_append : pdgmgroup_append_el.text
          pdgmgroup_mod = pdgmgroup_mod_el.nil? ? group_mod : {:match => pdgmgroup_mod_el['match'], :search => pdgmgroup_mod_el['search'], :replace => pdgmgroup_mod_el['replace']}
          pdgmgroup_endlength = pdgmgroup_endlength_el.nil? ? group_endlength : pdgmgroup_endlength_el.text.to_i
          
          paradigm_search = "group[@id='#{form}']/pdgmgroup[@id='#{paradigm[:person]}']/paradigm[@id='#{paradigm[:quant]}']"
          paradigm_el = search_current_el paradigm_search
          
          # skip this paradigm if the "ignore" attribute is set
          next unless paradigm_el['ignore'].nil?
          
          # grab modifier elements and extract their values
          # if unset, try to inherit from parent paradigm group
          paradigm_prepend_el = paradigm_el.at_xpath('prepend'); paradigm_append_el = paradigm_el.at_xpath('append'); paradigm_mod_el = paradigm_el.at_xpath('mod'); paradigm_endlength_el = paradigm_el.at_xpath('endlength')
          prepend = paradigm_prepend_el.nil? ? pdgmgroup_prepend : paradigm_prepend_el.text
          append = paradigm_append_el.nil? ? pdgmgroup_append : paradigm_append_el.text
          mod = paradigm_mod_el.nil? ? pdgmgroup_mod : {:match => paradigm_mod_el['match'], :search => paradigm_mod_el['search'], :replace => paradigm_mod_el['replace']}
          
          endlength = paradigm_endlength_el.nil? ? pdgmgroup_endlength : paradigm_endlength_el.text.to_i
          endlength = 0 if endlength.nil? or endlength < 0
          
          # make a copy of verb to run the modifiers on
          modded_verb = verb
          
          # chop n chars from the end of the string, based on the <endlength> modifier
          modded_verb = modded_verb[0 ... ( modded_verb.length - endlength )] unless endlength.nil?
          
          # <mod> modifier (regex replacement)
          unless mod.nil?
            case mod[:match]
            when 'first' then modded_verb.sub!(mod[:search], mod[:replace])
            when 'last' then modded_verb.sub!(/(.*)#{mod[:search]}(.*)/, "\1#{mod[:replace]}\3")
            when 'all' then modded_verb.gsub!(mod[:search], mod[:replace])
            end
          end
          
          # <append> and <prepend> modifiers
          modded_verb = ( prepend.nil? ? '' : prepend ) + modded_verb + ( append.nil? ? '' : append )
          ret[form][paradigm[:person] + paradigm[:quant]] = modded_verb
        end
      end
      
      @current_el = nil
      @current_el_inheritor = nil
      
      ret
    end
Hmm.. what does this do.. ?