Sha256: 7044467bdbba183f66abb0483ad64dd7f023a466e9109387f50d55db679572c6
Contents?: true
Size: 1.59 KB
Versions: 2
Compression:
Stored size: 1.59 KB
Contents
class PremisePair attr_reader :major, :minor def initialize(major, minor) @major = major @minor = minor end def middle termarray = [@major.subject.label, @major.predicate.label, @minor.subject.label, @minor.predicate.label] middle = nil if self.three_term_pair? termarray.detect do |term| if termarray.count(term) == 2 middle = Term.new(term) end end else middle = "Error: this is not a three term syllogism" end return middle end def three_term_pair? termarray = [@major.subject.label, @major.predicate.label, @minor.subject.label, @minor.predicate.label] if termarray.uniq.size == 3 answer = true else answer = false end end def majorterm if @major.subject.label == self.middle.label majorterm = @major.predicate else majorterm = @major.subject end majorterm end def minorterm if @minor.subject.label == self.middle.label minorterm = @minor.predicate else minorterm = @minor.subject end minorterm end # still need a test for this def possible_conclusions @possible_conclusions = [ Proposition.new(Quantity.new("universal"), self.minor, Quality.new("affirmative"), self.minor, true), Proposition.new(Quantity.new("universal"), self.minor, Quality.new("negative"), self.minor, true), Proposition.new(Quantity.new("particular"), self.minor, Quality.new("affirmative"), self.minor, true), Proposition.new(Quantity.new("particular"), self.minor, Quality.new("negative"), self.minor, true) ] end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
catlogic-0.0.2 | lib/catlogic/premise_pair.rb |
catlogic-0.0.1 | lib/catlogic/premise_pair.rb |