# File lib/wordnet/synset.rb, line 94 def initialize( type, offset, pos=Noun, sourceWn=0, targetWn=0 ) # Allow type = '!', 'antonym', or :antonym. Also handle # splitting of :memberMeronym and '%m' into their correct # type/subtype parts. @type = @subtype = nil if type.to_s.length == 1 @type = PointerSymbols[ type[0,1] ] elsif type.to_s.length == 2 @type = PointerSymbols[ type[0,1] ] @subtype = PointerSubTypes[ @type ].index( type ) else if PointerTypes.key?( type.to_s.intern ) @type = type.to_s.intern elsif /([a-z]+)([A-Z][a-z]+)/ =~ type.to_s subtype, maintype = $1, $2.downcase @type = maintype.intern if PointerTypes.key?( maintype.intern ) @subtype = subtype.intern end end raise ArgumentError, "No such pointer type %p" % type if @type.nil? # Allow pos = 'n', 'noun', or :noun @partOfSpeech = nil if pos.to_s.length == 1 @partOfSpeech = SyntacticSymbols[ pos ] else @partOfSpeech = pos.to_s.intern if SyntacticCategories.key?( pos.to_s.intern ) end raise ArgumentError, "No such part of speech %p" % pos if @partOfSpeech.nil? # Other attributes @offset = offset @sourceWn = sourceWn @targetWn = targetWn end