Linguistics::EN::

Conjugation

module
Extended With
Loggability

This file contains functions for conjugating verbs.

Version

$Id: conjugation.rb,v 08d2e43206b3 2015/03/12 20:32:17 ged $

Authors

Based on MorphAdorner (morphadorner.northwestern.edu/), which is licensed under the following terms:

Copyright © 2006-2009 by Northwestern University. All rights reserved.

Developed by: Academic and Research Technologies Northwestern University www.it.northwestern.edu/about/departments/at/

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal with the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimers.

Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimers in the documentation
and/or other materials provided with the distribution.

Neither the names of Academic and Research Technologies, Northwestern
University, nor the names of its contributors may be used to endorse or
promote products derived from this Software without specific prior written
permission.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.

Public Instance Methods

anchor
conjugate( tense, person=nil )

Conjugate the receiving string as an infinitive with the specified tense and person.

# File lib/linguistics/en/conjugation.rb, line 97
def conjugate( tense, person=nil )
        self.log.debug "Conjugating %p in %s tense, %s person" %
                [ self.to_s, tense, person || "any" ]
        person ||= :*
        verb = self.to_s.downcase

        if result = get_irregular( verb, person, tense )
                self.log.debug "  verb %p is irregular: %p" % [ verb, result ]
                return result
        end

        self.log.debug "  regular verb: conjugating by tense"
        return case tense
                when :present
                        conjugate_present( verb, person )
                when :present_participle
                        conjugate_present_participle( verb )
                when :past
                        conjugate_past( verb )
                when :past_participle
                        conjugate_past_participle( verb )
                else
                        verb
                end
end
anchor
past_participle( person=nil )

Return the past participle of the word

# File lib/linguistics/en/conjugation.rb, line 77
def past_participle( person=nil )
        return self.conjugate( :past_participle, person )
end
anchor
past_tense( person=nil )

Return the past tense of the word

# File lib/linguistics/en/conjugation.rb, line 71
def past_tense( person=nil )
        return self.conjugate( :past, person )
end
anchor
present_participle( person=nil )

Return the present participle of the word

# File lib/linguistics/en/conjugation.rb, line 89
def present_participle( person=nil )
        return self.conjugate( :present_participle, person )
end
anchor
present_tense( person=nil )

Return the present tense of the word

# File lib/linguistics/en/conjugation.rb, line 83
def present_tense( person=nil )
        return self.conjugate( :present, person )
end