Subversion Info

Rev
90
Last Checked In
2008-07-09 23:02:53 (8 weeks ago)
Checked in by
deveiant

Parent

Namespace

Included Modules

WordNet::Synset

"Synonym set" class - encapsulates the data for a set of words in the lexical database that are interchangeable in some context, and provides methods for accessing its relationships.

Constants

SVNId
Subversion ID
SVNRev
Subversion Rev

Attributes

filenum[RW]
The number corresponding to the lexicographer file name containing the synset. Calling #lexInfo will return the actual filename. See the "System Description" of wngloss(7WN) for more info about this.
frameslist[RW]
The list of raw verb sentence frames for this synset.
gloss[RW]
Definition and/or example sentences for the Synset.
lexicon[R]
The WordNet::Lexicon that was used to look up this synset
offset[RW]
The original byte offset of the synset in the data file; acts as the unique identifier (when combined with #part_of_speech) of this Synset in the database.
part_of_speech[RW]
The syntactic category of this Synset. Will be one of "n" (noun), "v" (verb), "a" (adjective), "r" (adverb), or "s" (other).
pointerlist[RW]
The list of raw pointers to related synsets. E.g., the pointerlist for "mourning dove" is:
  "@ 01731700%n 0000|#m 01733452%n 0000"
wordlist[RW]
The raw list of word/lex_id pairs associated with this synset. Each word and lex_id is separated by a ’%’ character, and each pair is delimited with a ’|’. E.g., the wordlist for "animal" is:
  "animal%0|animate_being%0|beast%0|brute%1|creature%0|fauna%1"

Public Class Methods

new( lexicon, offset, pos, word=nil, data=nil ) click to toggle source

Create a new Synset object in the specified lexicon for the specified word and part_of_speech. If data is specified, initialize the synset‘s other object data from it. This method shouldn‘t be called directly: you should use one of the Lexicon class‘s factory methods: #create_synset, #lookup_synsets, or #lookup_synsetsByOffset.

     # File lib/wordnet/synset.rb, line 304
304:         def initialize( lexicon, offset, pos, word=nil, data=nil )
305:             @lexicon = lexicon or
306:             raise ArgumentError, "%p is not a WordNet::Lexicon" % lexicon
307:             @part_of_speech  = SYNTACTIC_SYMBOLS[ pos ] or
308:             raise ArgumentError, "No such part of speech %p" % pos
309:             @mutex = Sync::new
310:             @pointers = []
311: 
312:             if data
313:                 @offset = offset.to_i
314:                 @filenum, @wordlist, @pointerlist,
315:                 @frameslist, @gloss = data.split( DELIM_RE )
316:             else
317:                 @offset = 1
318:                 @wordlist = word ? word : ''
319:                 @filenum, @pointerlist, @frameslist, @gloss = [''] * 4
320:             end
321:         end

Public Instance Methods

==( otherSyn ) click to toggle source

Returns true if the receiver and otherSyn are identical according to their offsets.

     # File lib/wordnet/synset.rb, line 406
406:         def ==( otherSyn )
407:             return false unless otherSyn.kind_of?( WordNet::Synset )
408:             return self.offset == otherSyn.offset
409:         end
add_words( *newWords ) click to toggle source

Add the specified newWords to this synset‘s wordlist. Alias: add_words.

     # File lib/wordnet/synset.rb, line 435
435:         def add_words( *newWords )
436:             @mutex.synchronize( Sync::EX ) {
437:                 self.words |= newWords
438:             }
439:         end
coordinates() click to toggle source

Returns an Array of the coordinate sisters of the receiver.

     # File lib/wordnet/synset.rb, line 672
672:             def coordinates
673:                 self.hypernyms.collect {|syn|
674:                     syn.hyponyms
675:                     }.flatten
676:                 end
delete_words( *oldWords ) click to toggle source

Delete the specified oldWords from this synset‘s wordlist. Alias: delete_words.

     # File lib/wordnet/synset.rb, line 444
444:         def delete_words( *oldWords )
445:             @mutex.synchronize( Sync::EX ) {
446:                 self.words -= oldWords
447:             }
448:         end
distance( type, otherSynset ) click to toggle source

Returns the distance in pointers between the receiver and otherSynset using type as the search path.

     # File lib/wordnet/synset.rb, line 793
793:                 def distance( type, otherSynset )
794:                     dist = nil
795:                     self.traverse( type ) {|syn,depth|
796:                         if syn == otherSynset
797:                             dist = depth
798:                             true
799:                         end
800:                     }
801: 
802:                     return dist
803:                 end
frames() click to toggle source

Returns an Array of verb frame +String+s for the synset.

     # File lib/wordnet/synset.rb, line 701
701:                 def frames
702:                     frarray = self.frameslist.split( WordNet::SUB_DELIM_RE )
703:                     verbFrames = []
704: 
705:                     @mutex.synchronize( Sync::SH ) {
706:                         frarray.each {|fr|
707:                             fnum, wnum = fr.split
708:                             if wnum > 0
709:                                 wordtext = " (" + self.words[wnum] + ")"
710:                                 verbFrames.push VERB_SENTS[ fnum ] + wordtext
711:                             else
712:                                 verbFrames.push VERB_SENTS[ fnum ]
713:                             end
714:                         }
715:                     }
716: 
717:                     return verbFrames
718:                 end
glosses() click to toggle source

Return each of the sentences of the gloss for this synset as an array. The gloss is a definition of the synset, and optionally one or more example sentences.

     # File lib/wordnet/synset.rb, line 399
399:         def glosses
400:             return self.gloss.split( /\s*;\s*/ )
401:         end
inspect() click to toggle source

Return a human-readable representation of the Synset suitable for debugging.

     # File lib/wordnet/synset.rb, line 365
365:         def inspect
366:             pointer_counts = self.pointer_map.collect {|type,ptrs|
367:                 "#{type}s: #{ptrs.length}"
368:                 }.join( ", " )
369: 
370:                 %q{#<%s:0x%08x/%s %s (%s): "%s" (%s)>} % [
371:                 self.class.name,
372:                 self.object_id * 2,
373:                 self.offset,
374:                 self.words.join(", "),
375:                 self.part_of_speech,
376:                 self.gloss,
377:                 pointer_counts,
378:             ]
379:         end
key() click to toggle source

Returns the Synset‘s unique identifier, made up of its offset and syntactic category catenated together with a ’%’ symbol.

     # File lib/wordnet/synset.rb, line 384
384:         def key
385:             "%d%%%s" % [ self.offset, self.pos ]
386:         end
lexInfo=( id ) click to toggle source

Sets the "lexicographer‘s file" association for this synset to id. The value in id should correspond to one of the values in #WordNet::LEXFILES

     # File lib/wordnet/synset.rb, line 691
691:                 def lexInfo=( id )
692:                     raise ArgumentError, "Bad index: Lexinfo id must be within LEXFILES" unless
693:                     LEXFILES[id]
694:                     @mutex.synchronize( Sync::EX ) {
695:                         self.filenum = id
696:                     }
697:                 end
lex_info() click to toggle source

Return the name of the "lexicographer‘s file" associated with this synset.

     # File lib/wordnet/synset.rb, line 681
681:                 def lex_info
682:                     @mutex.synchronize( Sync::SH ) {
683:                         return LEXFILES[ self.filenum.to_i ]
684:                     }
685:                 end
overview() click to toggle source

Alias for #to_s

pointer_map() click to toggle source

Returns the synset‘s pointers in a Hash keyed by their type.

     # File lib/wordnet/synset.rb, line 860
860:                     def pointer_map
861:                         return self.pointers.inject( {} ) do |hsh,ptr|
862:                             hsh[ ptr.type ] ||= []
863:                             hsh[ ptr.type ] << ptr
864:                             hsh
865:                         end
866:                     end
pointers() click to toggle source

Returns the pointers in this synset‘s pointerlist as an Array

     # File lib/wordnet/synset.rb, line 838
838:                 def pointers
839:                     @mutex.synchronize( Sync::SH ) {
840:                         @mutex.synchronize( Sync::EX ) {
841:                             @pointers = @pointerlist.split(SUB_DELIM_RE).collect {|pstr|
842:                                 Pointer::parse( pstr )
843:                             }
844:                             } if @pointers.empty?
845:                             @pointers
846:                         }
847:                     end
pointers=( *newPointers ) click to toggle source

Set the pointers in this synset‘s pointerlist to newPointers

     # File lib/wordnet/synset.rb, line 851
851:                     def pointers=( *newPointers )
852:                         @mutex.synchronize( Sync::EX ) {
853:                             @pointerlist = newPointers.collect {|ptr| ptr.to_s}.join( SUB_DELIM )
854:                             @pointers = newPointers
855:                         }
856:                     end
pos() click to toggle source

The symbol which represents this synset‘s syntactic category. Will be one of :noun, :verb, :adjective, :adverb, or :other.

     # File lib/wordnet/synset.rb, line 391
391:         def pos
392:             return SYNTACTIC_CATEGORIES[ @part_of_speech ]
393:         end
remove() click to toggle source

Removes this synset from the database.

     # File lib/wordnet/synset.rb, line 473
473:         def remove
474:             @mutex.synchronize( Sync::EX ) {
475:                 self.lexicon.remove_synset( self )
476:             }
477:         end
search( type, otherSynset ) click to toggle source

Recursively searches all of the receiver‘s pointers of the specified type for otherSynset, returning true if it is found.

     # File lib/wordnet/synset.rb, line 808
808:                 def search( type, otherSynset )
809:                     self.traverse( type ) {|syn,depth|
810:                         syn == otherSynset
811:                     }
812:                 end
serialize() click to toggle source

Returns the synset‘s data in a form suitable for storage in the lexicon‘s database.

     # File lib/wordnet/synset.rb, line 482
482:         def serialize
483:             @mutex.synchronize( Sync::SH ) {
484:                 return [
485:                     @filenum,
486:                     @wordlist,
487:                     @pointerlist,
488:                     @frameslist,
489:                     @gloss
490:                     ].join( WordNet::DELIM )
491:                 }
492:             end
store() click to toggle source

Writes any changes made to the object to the database and updates all affected synset data and indexes. If the object passes out of scope before #write is called, the changes are lost.

     # File lib/wordnet/synset.rb, line 464
464:         def store
465:             @mutex.synchronize( Sync::EX ) {
466:                 self.lexicon.store_synset( self )
467:             }
468:         end
Also aliased as: write
synonyms() click to toggle source

Alias for #words

to_s() click to toggle source

Return the synset as a string. Alias: overview.

     # File lib/wordnet/synset.rb, line 452
452:         def to_s
453:             @mutex.synchronize( Sync::SH ) {
454:                 wordlist = self.words.join(", ").gsub( /%\d/, '' ).gsub( /_/, ' ' )
455:                 return "#{wordlist} [#{self.part_of_speech}] -- (#{self.gloss})"
456:             }
457:         end
Also aliased as: overview
traverse( type, includeOrigin=true ) {|syn, newDepth| ...} click to toggle source

Traversal iterator: Iterates depth-first over a particular type of the receiver, and all of the pointed-to synset‘s pointers. If called with a block, the block is called once for each synset with the foundSyn and its depth in relation to the originating synset as arguments. The first call will be the originating synset with a depth of 0 unless includeOrigin is false. If the callback returns true, the traversal is halted, and the method returns immediately. This method returns an Array of the synsets which were traversed if no block is given, or a flag which indicates whether or not the traversal was interrupted if a block is given.

     # File lib/wordnet/synset.rb, line 732
732:                 def traverse( type, includeOrigin=true )
733:                     raise ArgumentError, "Illegal parameter 1: Must be either a String or a Symbol" unless
734:                     type.kind_of?( String ) || type.kind_of?( Symbol )
735: 
736:                     raise ArgumentError, "Synset doesn't support the #{type.to_s} pointer type." unless
737:                     self.respond_to?( type )
738: 
739:                     foundSyns = []
740:                     depth = 0
741:                     traversalFunc = nil
742: 
743:                     # Build a traversal function which we can call recursively. It'll return
744:                     # the synsets it traverses.
745:                     traversalFunc = Proc.new {|syn,newDepth|
746: 
747:                         # Flag to continue traversal
748:                         haltFlag = false
749: 
750:                         # Call the block if it exists and we're either past the origin or
751:                         # including it
752:                         if block_given? && (newDepth > 0 || includeOrigin)
753:                             res = yield( syn, newDepth )
754:                             haltFlag = true if res.is_a? TrueClass
755:                         end
756: 
757:                         # Make an array for holding sub-synsets we see
758:                         subSyns = []
759:                         subSyns.push( syn ) unless newDepth == 0 && !includeOrigin
760: 
761:                         # Iterate over each synset returned by calling the pointer on the
762:                         # current syn. For each one, we call ourselves recursively, and
763:                         # break out of the iterator with a false value if the block has
764:                         # indicated we should abort by returning a false value.
765:                         unless haltFlag
766:                             syn.send( type ).each {|subSyn|
767:                                 subSubSyns, haltFlag = traversalFunc.call( subSyn, newDepth + 1 )
768:                                 subSyns.push( *subSubSyns ) unless subSubSyns.empty?
769:                                 break if haltFlag
770:                             }
771:                         end
772: 
773:                         # return
774:                         [ subSyns, haltFlag ]
775:                     }
776: 
777:                     # Call the iterator
778:                     traversedSets, haltFlag =  traversalFunc.call( self, depth )
779: 
780:                     # If a block was given, just return whether or not the block was halted.
781:                     if block_given?
782:                         return haltFlag
783: 
784:                         # If no block was given, return the traversed synsets
785:                     else
786:                         return traversedSets
787:                     end
788:                 end
words() click to toggle source

Returns an Array of words and/or collocations associated with this synset.

     # File lib/wordnet/synset.rb, line 415
415:         def words
416:             @mutex.synchronize( Sync::SH ) {
417:                 self.wordlist.split( SUB_DELIM_RE ).collect do |word|
418:                     word.gsub( /_/, ' ' ).sub( /%.*$/, '' )
419:                 end
420:             }
421:         end
Also aliased as: synonyms
words=( *newWords ) click to toggle source

Set the words in this synset‘s wordlist to newWords

     # File lib/wordnet/synset.rb, line 426
426:         def words=( *newWords )
427:             @mutex.synchronize( Sync::EX ) {
428:                 @wordlist = newWords.join( SUB_DELIM )
429:             }
430:         end
write() click to toggle source

Alias for #store

|( otherSyn ) click to toggle source

Union: Return the least general synset that the receiver and otherSynset have in common as a hypernym, or nil if it doesn‘t share any.

     # File lib/wordnet/synset.rb, line 818
818:                 def |( otherSyn )
819: 
820:                     # Find all of this syn's hypernyms
821:                     hyperSyns = self.traverse( :hypernyms )
822:                     commonSyn = nil
823: 
824:                     # Now traverse the other synset's hypernyms looking for one of our
825:                     # own hypernyms.
826:                     otherSyn.traverse( :hypernyms ) {|syn,depth|
827:                         if hyperSyns.include?( syn )
828:                             commonSyn = syn
829:                             true
830:                         end
831:                     }
832: 
833:                     return commonSyn
834:                 end

Protected Instance Methods

fetch_synset_pointers( type, subtype=nil ) click to toggle source

Returns an Array of synset objects for the receiver‘s pointers of the specified type.

     # File lib/wordnet/synset.rb, line 876
876:                     def fetch_synset_pointers( type, subtype=nil )
877:                         synsets = nil
878: 
879:                         # Iterate over this synset's pointers, looking for ones that match
880:                         # the type we're after. When we find one, we extract its offset and
881:                         # use that to look it up.
882:                         @mutex.synchronize( Sync::SH ) do
883:                             synsets = self.pointers.
884:                             find_all {|ptr|
885:                                 ptr.type == type and
886:                                 subtype.nil? || ptr.subtype == subtype
887:                                 }.
888:                                 collect {|ptr| ptr.synset }.
889:                                 collect {|key| @lexicon.lookup_synsets_by_key( key )}
890:                             end
891: 
892:                             return synsets.flatten
893:                         end
set_synset_pointers( type, synsets, subtype=nil ) click to toggle source

Sets the receiver‘s synset pointers for the specified type to the specified synsets.

     # File lib/wordnet/synset.rb, line 898
898:                         def set_synset_pointers( type, synsets, subtype=nil )
899:                             synsets = [ synsets ] unless synsets.is_a?( Array )
900:                             pmap = self.pointer_map
901:                             pmap[ type ] = synsets
902:                             self.pointers = pmap.values
903:                         end

secsequence

--- SEC00011

seccomment

--- ""

classlist

--- |
Class <a href="Synset/Pointer.html" class="link">WordNet::Synset::Pointer</a><br />

attributes

--- 
- name: filenum
  rw: RW
  a_desc: |+
    
    The number corresponding to the lexicographer file name containing the
    synset. Calling #lexInfo will return the actual filename. See the "System
    Description" of wngloss(7WN) for more info about this.
    
- name: frameslist
  rw: RW
  a_desc: |+
    
    The list of raw verb sentence frames for this synset.
    
- name: gloss
  rw: RW
  a_desc: |+
    
    Definition and/or example sentences for the <a
    href="Synset.html">Synset</a>.
    
- name: lexicon
  rw: R
  a_desc: |+
    
    The <a href="Lexicon.html">WordNet::Lexicon</a> that was used to look up
    this synset
    
- name: offset
  rw: RW
  a_desc: |+
    
    The original byte offset of the synset in the data file; acts as the unique
    identifier (when combined with #part_of_speech) of this <a
    href="Synset.html">Synset</a> in the database.
    
- name: part_of_speech
  rw: RW
  a_desc: |+
    
    The syntactic category of this <a href="Synset.html">Synset</a>. Will be
    one of "n" (noun), "v" (verb), "a" (adjective), "r" (adverb), or "s"
    (other).
    
- name: pointerlist
  rw: RW
  a_desc: |
    
    The list of raw pointers to related synsets. E.g., the pointerlist for
    "mourning dove" is:
    
    <pre>
      &quot;@ 01731700%n 0000|#m 01733452%n 0000&quot;
    </pre>

- name: wordlist
  rw: RW
  a_desc: |
    
    The raw list of word/lex_id pairs associated with this synset. Each word
    and lex_id is separated by a &#8217;%&#8217; character, and each pair is
    delimited with a &#8217;|&#8217;. E.g., the wordlist for "animal" is:
    
    <pre>
      &quot;animal%0|animate_being%0|beast%0|brute%1|creature%0|fauna%1&quot;
    </pre>

method_list

--- 
- methods: 
  - visibility: public
    aref: M000021
    name: new
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/wordnet/synset.rb, line 304</span>\n\
      304:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">initialize</span>( <span class=\"ruby-identifier\">lexicon</span>, <span class=\"ruby-identifier\">offset</span>, <span class=\"ruby-identifier\">pos</span>, <span class=\"ruby-identifier\">word</span>=<span class=\"ruby-keyword kw\">nil</span>, <span class=\"ruby-identifier\">data</span>=<span class=\"ruby-keyword kw\">nil</span> )\n\
      305:             <span class=\"ruby-ivar\">@lexicon</span> = <span class=\"ruby-identifier\">lexicon</span> <span class=\"ruby-keyword kw\">or</span>\n\
      306:             <span class=\"ruby-identifier\">raise</span> <span class=\"ruby-constant\">ArgumentError</span>, <span class=\"ruby-value str\">&quot;%p is not a WordNet::Lexicon&quot;</span> <span class=\"ruby-operator\">%</span> <span class=\"ruby-identifier\">lexicon</span>\n\
      307:             <span class=\"ruby-ivar\">@part_of_speech</span>  = <span class=\"ruby-constant\">SYNTACTIC_SYMBOLS</span>[ <span class=\"ruby-identifier\">pos</span> ] <span class=\"ruby-keyword kw\">or</span>\n\
      308:             <span class=\"ruby-identifier\">raise</span> <span class=\"ruby-constant\">ArgumentError</span>, <span class=\"ruby-value str\">&quot;No such part of speech %p&quot;</span> <span class=\"ruby-operator\">%</span> <span class=\"ruby-identifier\">pos</span>\n\
      309:             <span class=\"ruby-ivar\">@mutex</span> = <span class=\"ruby-constant\">Sync</span><span class=\"ruby-operator\">::</span><span class=\"ruby-identifier\">new</span>\n\
      310:             <span class=\"ruby-ivar\">@pointers</span> = []\n\
      311: \n\
      312:             <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">data</span>\n\
      313:                 <span class=\"ruby-ivar\">@offset</span> = <span class=\"ruby-identifier\">offset</span>.<span class=\"ruby-identifier\">to_i</span>\n\
      314:                 <span class=\"ruby-ivar\">@filenum</span>, <span class=\"ruby-ivar\">@wordlist</span>, <span class=\"ruby-ivar\">@pointerlist</span>,\n\
      315:                 <span class=\"ruby-ivar\">@frameslist</span>, <span class=\"ruby-ivar\">@gloss</span> = <span class=\"ruby-identifier\">data</span>.<span class=\"ruby-identifier\">split</span>( <span class=\"ruby-constant\">DELIM_RE</span> )\n\
      316:             <span class=\"ruby-keyword kw\">else</span>\n\
      317:                 <span class=\"ruby-ivar\">@offset</span> = <span class=\"ruby-value\">1</span>\n\
      318:                 <span class=\"ruby-ivar\">@wordlist</span> = <span class=\"ruby-identifier\">word</span> <span class=\"ruby-value\">? </span><span class=\"ruby-identifier\">word</span> <span class=\"ruby-operator\">:</span> <span class=\"ruby-value str\">''</span>\n\
      319:                 <span class=\"ruby-ivar\">@filenum</span>, <span class=\"ruby-ivar\">@pointerlist</span>, <span class=\"ruby-ivar\">@frameslist</span>, <span class=\"ruby-ivar\">@gloss</span> = [<span class=\"ruby-value str\">''</span>] <span class=\"ruby-operator\">*</span> <span class=\"ruby-value\">4</span>\n\
      320:             <span class=\"ruby-keyword kw\">end</span>\n\
      321:         <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Create a new <a href="Synset.html">Synset</a> object in the specified
      <tt>lexicon</tt> for the specified <tt>word</tt> and
      <tt>part_of_speech</tt>. If <tt>data</tt> is specified, initialize the
      synset&#8216;s other object data from it. This method shouldn&#8216;t be
      called directly: you should use one of the <a
      href="Lexicon.html">Lexicon</a> class&#8216;s factory methods:
      #create_synset, #lookup_synsets, or #lookup_synsetsByOffset.
      </p>
    params: ( lexicon, offset, pos, word=nil, data=nil )
  category: Class
  type: Public
- methods: 
  - visibility: public
    aref: M000026
    name: ==
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/wordnet/synset.rb, line 406</span>\n\
      406:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-operator\">==</span>( <span class=\"ruby-identifier\">otherSyn</span> )\n\
      407:             <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-keyword kw\">false</span> <span class=\"ruby-keyword kw\">unless</span> <span class=\"ruby-identifier\">otherSyn</span>.<span class=\"ruby-identifier\">kind_of?</span>( <span class=\"ruby-constant\">WordNet</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">Synset</span> )\n\
      408:             <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">offset</span> <span class=\"ruby-operator\">==</span> <span class=\"ruby-identifier\">otherSyn</span>.<span class=\"ruby-identifier\">offset</span>\n\
      409:         <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Returns true if the receiver and otherSyn are identical according to their
      offsets.
      </p>
    params: ( otherSyn )
  - visibility: public
    aref: M000030
    name: add_words
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/wordnet/synset.rb, line 435</span>\n\
      435:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">add_words</span>( <span class=\"ruby-operator\">*</span><span class=\"ruby-identifier\">newWords</span> )\n\
      436:             <span class=\"ruby-ivar\">@mutex</span>.<span class=\"ruby-identifier\">synchronize</span>( <span class=\"ruby-constant\">Sync</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">EX</span> ) {\n\
      437:                 <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">words</span> <span class=\"ruby-operator\">|=</span> <span class=\"ruby-identifier\">newWords</span>\n\
      438:             }\n\
      439:         <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Add the specified <tt>newWords</tt> to this synset&#8216;s wordlist. Alias:
      <tt><a href="Synset.html#M000030">add_words</a></tt>.
      </p>
    params: ( *newWords )
  - visibility: public
    aref: M000038
    name: coordinates
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/wordnet/synset.rb, line 672</span>\n\
      672:             <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">coordinates</span>\n\
      673:                 <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">hypernyms</span>.<span class=\"ruby-identifier\">collect</span> {<span class=\"ruby-operator\">|</span><span class=\"ruby-identifier\">syn</span><span class=\"ruby-operator\">|</span>\n\
      674:                     <span class=\"ruby-identifier\">syn</span>.<span class=\"ruby-identifier\">hyponyms</span>\n\
      675:                     }.<span class=\"ruby-identifier\">flatten</span>\n\
      676:                 <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Returns an Array of the coordinate sisters of the receiver.
      </p>
    params: ()
  - visibility: public
    aref: M000031
    name: delete_words
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/wordnet/synset.rb, line 444</span>\n\
      444:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">delete_words</span>( <span class=\"ruby-operator\">*</span><span class=\"ruby-identifier\">oldWords</span> )\n\
      445:             <span class=\"ruby-ivar\">@mutex</span>.<span class=\"ruby-identifier\">synchronize</span>( <span class=\"ruby-constant\">Sync</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">EX</span> ) {\n\
      446:                 <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">words</span> <span class=\"ruby-operator\">-=</span> <span class=\"ruby-identifier\">oldWords</span>\n\
      447:             }\n\
      448:         <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Delete the specified <tt>oldWords</tt> from this synset&#8216;s wordlist.
      Alias: <tt><a href="Synset.html#M000031">delete_words</a></tt>.
      </p>
    params: ( *oldWords )
  - visibility: public
    aref: M000043
    name: distance
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/wordnet/synset.rb, line 793</span>\n\
      793:                 <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">distance</span>( <span class=\"ruby-identifier\">type</span>, <span class=\"ruby-identifier\">otherSynset</span> )\n\
      794:                     <span class=\"ruby-identifier\">dist</span> = <span class=\"ruby-keyword kw\">nil</span>\n\
      795:                     <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">traverse</span>( <span class=\"ruby-identifier\">type</span> ) {<span class=\"ruby-operator\">|</span><span class=\"ruby-identifier\">syn</span>,<span class=\"ruby-identifier\">depth</span><span class=\"ruby-operator\">|</span>\n\
      796:                         <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">syn</span> <span class=\"ruby-operator\">==</span> <span class=\"ruby-identifier\">otherSynset</span>\n\
      797:                             <span class=\"ruby-identifier\">dist</span> = <span class=\"ruby-identifier\">depth</span>\n\
      798:                             <span class=\"ruby-keyword kw\">true</span>\n\
      799:                         <span class=\"ruby-keyword kw\">end</span>\n\
      800:                     }\n\
      801: \n\
      802:                     <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-identifier\">dist</span>\n\
      803:                 <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Returns the distance in pointers between the receiver and
      <tt>otherSynset</tt> using <tt>type</tt> as the search path.
      </p>
    params: ( type, otherSynset )
  - visibility: public
    aref: M000041
    name: frames
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/wordnet/synset.rb, line 701</span>\n\
      701:                 <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">frames</span>\n\
      702:                     <span class=\"ruby-identifier\">frarray</span> = <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">frameslist</span>.<span class=\"ruby-identifier\">split</span>( <span class=\"ruby-constant\">WordNet</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">SUB_DELIM_RE</span> )\n\
      703:                     <span class=\"ruby-identifier\">verbFrames</span> = []\n\
      704: \n\
      705:                     <span class=\"ruby-ivar\">@mutex</span>.<span class=\"ruby-identifier\">synchronize</span>( <span class=\"ruby-constant\">Sync</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">SH</span> ) {\n\
      706:                         <span class=\"ruby-identifier\">frarray</span>.<span class=\"ruby-identifier\">each</span> {<span class=\"ruby-operator\">|</span><span class=\"ruby-identifier\">fr</span><span class=\"ruby-operator\">|</span>\n\
      707:                             <span class=\"ruby-identifier\">fnum</span>, <span class=\"ruby-identifier\">wnum</span> = <span class=\"ruby-identifier\">fr</span>.<span class=\"ruby-identifier\">split</span>\n\
      708:                             <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">wnum</span> <span class=\"ruby-operator\">&gt;</span> <span class=\"ruby-value\">0</span>\n\
      709:                                 <span class=\"ruby-identifier\">wordtext</span> = <span class=\"ruby-value str\">&quot; (&quot;</span> <span class=\"ruby-operator\">+</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">words</span>[<span class=\"ruby-identifier\">wnum</span>] <span class=\"ruby-operator\">+</span> <span class=\"ruby-value str\">&quot;)&quot;</span>\n\
      710:                                 <span class=\"ruby-identifier\">verbFrames</span>.<span class=\"ruby-identifier\">push</span> <span class=\"ruby-constant\">VERB_SENTS</span>[ <span class=\"ruby-identifier\">fnum</span> ] <span class=\"ruby-operator\">+</span> <span class=\"ruby-identifier\">wordtext</span>\n\
      711:                             <span class=\"ruby-keyword kw\">else</span>\n\
      712:                                 <span class=\"ruby-identifier\">verbFrames</span>.<span class=\"ruby-identifier\">push</span> <span class=\"ruby-constant\">VERB_SENTS</span>[ <span class=\"ruby-identifier\">fnum</span> ]\n\
      713:                             <span class=\"ruby-keyword kw\">end</span>\n\
      714:                         }\n\
      715:                     }\n\
      716: \n\
      717:                     <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-identifier\">verbFrames</span>\n\
      718:                 <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Returns an <tt>Array</tt> of verb frame +String+s for the synset.
      </p>
    params: ()
  - visibility: public
    aref: M000025
    name: glosses
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/wordnet/synset.rb, line 399</span>\n\
      399:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">glosses</span>\n\
      400:             <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">gloss</span>.<span class=\"ruby-identifier\">split</span>( <span class=\"ruby-regexp re\">/\\s*;\\s*/</span> )\n\
      401:         <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Return each of the sentences of the gloss for this synset as an array. The
      gloss is a definition of the synset, and optionally one or more example
      sentences.
      </p>
    params: ()
  - visibility: public
    aref: M000022
    name: inspect
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/wordnet/synset.rb, line 365</span>\n\
      365:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">inspect</span>\n\
      366:             <span class=\"ruby-identifier\">pointer_counts</span> = <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">pointer_map</span>.<span class=\"ruby-identifier\">collect</span> {<span class=\"ruby-operator\">|</span><span class=\"ruby-identifier\">type</span>,<span class=\"ruby-identifier\">ptrs</span><span class=\"ruby-operator\">|</span>\n\
      367:                 <span class=\"ruby-node\">&quot;#{type}s: #{ptrs.length}&quot;</span>\n\
      368:                 }.<span class=\"ruby-identifier\">join</span>( <span class=\"ruby-value str\">&quot;, &quot;</span> )\n\
      369: \n\
      370:                 <span class=\"ruby-value str\">%q{#&lt;%s:0x%08x/%s %s (%s): &quot;%s&quot; (%s)&gt;}</span> <span class=\"ruby-operator\">%</span> [\n\
      371:                 <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">class</span>.<span class=\"ruby-identifier\">name</span>,\n\
      372:                 <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">object_id</span> <span class=\"ruby-operator\">*</span> <span class=\"ruby-value\">2</span>,\n\
      373:                 <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">offset</span>,\n\
      374:                 <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">words</span>.<span class=\"ruby-identifier\">join</span>(<span class=\"ruby-value str\">&quot;, &quot;</span>),\n\
      375:                 <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">part_of_speech</span>,\n\
      376:                 <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">gloss</span>,\n\
      377:                 <span class=\"ruby-identifier\">pointer_counts</span>,\n\
      378:             ]\n\
      379:         <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Return a human-readable representation of the <a
      href="Synset.html">Synset</a> suitable for debugging.
      </p>
    params: ()
  - visibility: public
    aref: M000023
    name: key
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/wordnet/synset.rb, line 384</span>\n\
      384:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">key</span>\n\
      385:             <span class=\"ruby-value str\">&quot;%d%%%s&quot;</span> <span class=\"ruby-operator\">%</span> [ <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">offset</span>, <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">pos</span> ]\n\
      386:         <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Returns the <a href="Synset.html">Synset</a>&#8216;s unique identifier,
      made up of its offset and syntactic category catenated together with a
      &#8217;%&#8217; symbol.
      </p>
    params: ()
  - visibility: public
    aref: M000040
    name: lexInfo=
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/wordnet/synset.rb, line 691</span>\n\
      691:                 <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">lexInfo=</span>( <span class=\"ruby-identifier\">id</span> )\n\
      692:                     <span class=\"ruby-identifier\">raise</span> <span class=\"ruby-constant\">ArgumentError</span>, <span class=\"ruby-value str\">&quot;Bad index: Lexinfo id must be within LEXFILES&quot;</span> <span class=\"ruby-keyword kw\">unless</span>\n\
      693:                     <span class=\"ruby-constant\">LEXFILES</span>[<span class=\"ruby-identifier\">id</span>]\n\
      694:                     <span class=\"ruby-ivar\">@mutex</span>.<span class=\"ruby-identifier\">synchronize</span>( <span class=\"ruby-constant\">Sync</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">EX</span> ) {\n\
      695:                         <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">filenum</span> = <span class=\"ruby-identifier\">id</span>\n\
      696:                     }\n\
      697:                 <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Sets the "lexicographer&#8216;s file" association for this synset to
      <tt>id</tt>. The value in <tt>id</tt> should correspond to one of the
      values in <a href="../WordNet.html">#WordNet</a>::LEXFILES
      </p>
    params: ( id )
  - visibility: public
    aref: M000039
    name: lex_info
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/wordnet/synset.rb, line 681</span>\n\
      681:                 <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">lex_info</span>\n\
      682:                     <span class=\"ruby-ivar\">@mutex</span>.<span class=\"ruby-identifier\">synchronize</span>( <span class=\"ruby-constant\">Sync</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">SH</span> ) {\n\
      683:                         <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-constant\">LEXFILES</span>[ <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">filenum</span>.<span class=\"ruby-identifier\">to_i</span> ]\n\
      684:                     }\n\
      685:                 <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Return the name of the "lexicographer&#8216;s file" associated with this
      synset.
      </p>
    params: ()
  - visibility: public
    aref: M000033
    name: overview
    m_desc: |-
      <p>
      Alias for <a href="Synset.html#M000032">#to_s</a>
      </p>
    params: ()
  - visibility: public
    aref: M000048
    name: pointer_map
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/wordnet/synset.rb, line 860</span>\n\
      860:                     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">pointer_map</span>\n\
      861:                         <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">pointers</span>.<span class=\"ruby-identifier\">inject</span>( {} ) <span class=\"ruby-keyword kw\">do</span> <span class=\"ruby-operator\">|</span><span class=\"ruby-identifier\">hsh</span>,<span class=\"ruby-identifier\">ptr</span><span class=\"ruby-operator\">|</span>\n\
      862:                             <span class=\"ruby-identifier\">hsh</span>[ <span class=\"ruby-identifier\">ptr</span>.<span class=\"ruby-identifier\">type</span> ] <span class=\"ruby-operator\">||=</span> []\n\
      863:                             <span class=\"ruby-identifier\">hsh</span>[ <span class=\"ruby-identifier\">ptr</span>.<span class=\"ruby-identifier\">type</span> ] <span class=\"ruby-operator\">&lt;&lt;</span> <span class=\"ruby-identifier\">ptr</span>\n\
      864:                             <span class=\"ruby-identifier\">hsh</span>\n\
      865:                         <span class=\"ruby-keyword kw\">end</span>\n\
      866:                     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Returns the synset&#8216;s pointers in a Hash keyed by their type.
      </p>
    params: ()
  - visibility: public
    aref: M000046
    name: pointers
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/wordnet/synset.rb, line 838</span>\n\
      838:                 <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">pointers</span>\n\
      839:                     <span class=\"ruby-ivar\">@mutex</span>.<span class=\"ruby-identifier\">synchronize</span>( <span class=\"ruby-constant\">Sync</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">SH</span> ) {\n\
      840:                         <span class=\"ruby-ivar\">@mutex</span>.<span class=\"ruby-identifier\">synchronize</span>( <span class=\"ruby-constant\">Sync</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">EX</span> ) {\n\
      841:                             <span class=\"ruby-ivar\">@pointers</span> = <span class=\"ruby-ivar\">@pointerlist</span>.<span class=\"ruby-identifier\">split</span>(<span class=\"ruby-constant\">SUB_DELIM_RE</span>).<span class=\"ruby-identifier\">collect</span> {<span class=\"ruby-operator\">|</span><span class=\"ruby-identifier\">pstr</span><span class=\"ruby-operator\">|</span>\n\
      842:                                 <span class=\"ruby-constant\">Pointer</span><span class=\"ruby-operator\">::</span><span class=\"ruby-identifier\">parse</span>( <span class=\"ruby-identifier\">pstr</span> )\n\
      843:                             }\n\
      844:                             } <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-ivar\">@pointers</span>.<span class=\"ruby-identifier\">empty?</span>\n\
      845:                             <span class=\"ruby-ivar\">@pointers</span>\n\
      846:                         }\n\
      847:                     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Returns the pointers in this synset&#8216;s pointerlist as an
      <tt>Array</tt>
      </p>
    params: ()
  - visibility: public
    aref: M000047
    name: pointers=
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/wordnet/synset.rb, line 851</span>\n\
      851:                     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">pointers=</span>( <span class=\"ruby-operator\">*</span><span class=\"ruby-identifier\">newPointers</span> )\n\
      852:                         <span class=\"ruby-ivar\">@mutex</span>.<span class=\"ruby-identifier\">synchronize</span>( <span class=\"ruby-constant\">Sync</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">EX</span> ) {\n\
      853:                             <span class=\"ruby-ivar\">@pointerlist</span> = <span class=\"ruby-identifier\">newPointers</span>.<span class=\"ruby-identifier\">collect</span> {<span class=\"ruby-operator\">|</span><span class=\"ruby-identifier\">ptr</span><span class=\"ruby-operator\">|</span> <span class=\"ruby-identifier\">ptr</span>.<span class=\"ruby-identifier\">to_s</span>}.<span class=\"ruby-identifier\">join</span>( <span class=\"ruby-constant\">SUB_DELIM</span> )\n\
      854:                             <span class=\"ruby-ivar\">@pointers</span> = <span class=\"ruby-identifier\">newPointers</span>\n\
      855:                         }\n\
      856:                     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Set the pointers in this synset&#8216;s pointerlist to <tt>newPointers</tt>
      </p>
    params: ( *newPointers )
  - visibility: public
    aref: M000024
    name: pos
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/wordnet/synset.rb, line 391</span>\n\
      391:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">pos</span>\n\
      392:             <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-constant\">SYNTACTIC_CATEGORIES</span>[ <span class=\"ruby-ivar\">@part_of_speech</span> ]\n\
      393:         <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      The symbol which represents this synset&#8216;s syntactic category. Will be
      one of :noun, :verb, :adjective, :adverb, or :other.
      </p>
    params: ()
  - visibility: public
    aref: M000036
    name: remove
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/wordnet/synset.rb, line 473</span>\n\
      473:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">remove</span>\n\
      474:             <span class=\"ruby-ivar\">@mutex</span>.<span class=\"ruby-identifier\">synchronize</span>( <span class=\"ruby-constant\">Sync</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">EX</span> ) {\n\
      475:                 <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">lexicon</span>.<span class=\"ruby-identifier\">remove_synset</span>( <span class=\"ruby-keyword kw\">self</span> )\n\
      476:             }\n\
      477:         <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Removes this synset from the database.
      </p>
    params: ()
  - visibility: public
    aref: M000044
    name: search
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/wordnet/synset.rb, line 808</span>\n\
      808:                 <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">search</span>( <span class=\"ruby-identifier\">type</span>, <span class=\"ruby-identifier\">otherSynset</span> )\n\
      809:                     <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">traverse</span>( <span class=\"ruby-identifier\">type</span> ) {<span class=\"ruby-operator\">|</span><span class=\"ruby-identifier\">syn</span>,<span class=\"ruby-identifier\">depth</span><span class=\"ruby-operator\">|</span>\n\
      810:                         <span class=\"ruby-identifier\">syn</span> <span class=\"ruby-operator\">==</span> <span class=\"ruby-identifier\">otherSynset</span>\n\
      811:                     }\n\
      812:                 <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Recursively searches all of the receiver&#8216;s pointers of the specified
      <tt>type</tt> for <tt>otherSynset</tt>, returning <tt>true</tt> if it is
      found.
      </p>
    params: ( type, otherSynset )
  - visibility: public
    aref: M000037
    name: serialize
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/wordnet/synset.rb, line 482</span>\n\
      482:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">serialize</span>\n\
      483:             <span class=\"ruby-ivar\">@mutex</span>.<span class=\"ruby-identifier\">synchronize</span>( <span class=\"ruby-constant\">Sync</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">SH</span> ) {\n\
      484:                 <span class=\"ruby-keyword kw\">return</span> [\n\
      485:                     <span class=\"ruby-ivar\">@filenum</span>,\n\
      486:                     <span class=\"ruby-ivar\">@wordlist</span>,\n\
      487:                     <span class=\"ruby-ivar\">@pointerlist</span>,\n\
      488:                     <span class=\"ruby-ivar\">@frameslist</span>,\n\
      489:                     <span class=\"ruby-ivar\">@gloss</span>\n\
      490:                     ].<span class=\"ruby-identifier\">join</span>( <span class=\"ruby-constant\">WordNet</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">DELIM</span> )\n\
      491:                 }\n\
      492:             <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Returns the synset&#8216;s data in a form suitable for storage in the
      lexicon&#8216;s database.
      </p>
    params: ()
  - visibility: public
    aref: M000034
    name: store
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/wordnet/synset.rb, line 464</span>\n\
      464:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">store</span>\n\
      465:             <span class=\"ruby-ivar\">@mutex</span>.<span class=\"ruby-identifier\">synchronize</span>( <span class=\"ruby-constant\">Sync</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">EX</span> ) {\n\
      466:                 <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">lexicon</span>.<span class=\"ruby-identifier\">store_synset</span>( <span class=\"ruby-keyword kw\">self</span> )\n\
      467:             }\n\
      468:         <span class=\"ruby-keyword kw\">end</span>"
    aka: 
    - aref: Synset.html#M000035
      name: write
    m_desc: |-
      <p>
      Writes any changes made to the object to the database and updates all
      affected synset data and indexes. If the object passes out of scope before
      <a href="Synset.html#M000035">#write</a> is called, the changes are lost.
      </p>
    params: ()
  - visibility: public
    aref: M000028
    name: synonyms
    m_desc: |-
      <p>
      Alias for <a href="Synset.html#M000027">#words</a>
      </p>
    params: ()
  - visibility: public
    aref: M000032
    name: to_s
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/wordnet/synset.rb, line 452</span>\n\
      452:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">to_s</span>\n\
      453:             <span class=\"ruby-ivar\">@mutex</span>.<span class=\"ruby-identifier\">synchronize</span>( <span class=\"ruby-constant\">Sync</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">SH</span> ) {\n\
      454:                 <span class=\"ruby-identifier\">wordlist</span> = <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">words</span>.<span class=\"ruby-identifier\">join</span>(<span class=\"ruby-value str\">&quot;, &quot;</span>).<span class=\"ruby-identifier\">gsub</span>( <span class=\"ruby-regexp re\">/%\\d/</span>, <span class=\"ruby-value str\">''</span> ).<span class=\"ruby-identifier\">gsub</span>( <span class=\"ruby-regexp re\">/_/</span>, <span class=\"ruby-value str\">' '</span> )\n\
      455:                 <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-node\">&quot;#{wordlist} [#{self.part_of_speech}] -- (#{self.gloss})&quot;</span>\n\
      456:             }\n\
      457:         <span class=\"ruby-keyword kw\">end</span>"
    aka: 
    - aref: Synset.html#M000033
      name: overview
    m_desc: |-
      <p>
      Return the synset as a string. Alias: <tt>overview</tt>.
      </p>
    params: ()
  - visibility: public
    aref: M000042
    name: traverse
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/wordnet/synset.rb, line 732</span>\n\
      732:                 <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">traverse</span>( <span class=\"ruby-identifier\">type</span>, <span class=\"ruby-identifier\">includeOrigin</span>=<span class=\"ruby-keyword kw\">true</span> )\n\
      733:                     <span class=\"ruby-identifier\">raise</span> <span class=\"ruby-constant\">ArgumentError</span>, <span class=\"ruby-value str\">&quot;Illegal parameter 1: Must be either a String or a Symbol&quot;</span> <span class=\"ruby-keyword kw\">unless</span>\n\
      734:                     <span class=\"ruby-identifier\">type</span>.<span class=\"ruby-identifier\">kind_of?</span>( <span class=\"ruby-constant\">String</span> ) <span class=\"ruby-operator\">||</span> <span class=\"ruby-identifier\">type</span>.<span class=\"ruby-identifier\">kind_of?</span>( <span class=\"ruby-constant\">Symbol</span> )\n\
      735: \n\
      736:                     <span class=\"ruby-identifier\">raise</span> <span class=\"ruby-constant\">ArgumentError</span>, <span class=\"ruby-node\">&quot;Synset doesn't support the #{type.to_s} pointer type.&quot;</span> <span class=\"ruby-keyword kw\">unless</span>\n\
      737:                     <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">respond_to?</span>( <span class=\"ruby-identifier\">type</span> )\n\
      738: \n\
      739:                     <span class=\"ruby-identifier\">foundSyns</span> = []\n\
      740:                     <span class=\"ruby-identifier\">depth</span> = <span class=\"ruby-value\">0</span>\n\
      741:                     <span class=\"ruby-identifier\">traversalFunc</span> = <span class=\"ruby-keyword kw\">nil</span>\n\
      742: \n\
      743:                     <span class=\"ruby-comment cmt\"># Build a traversal function which we can call recursively. It'll return</span>\n\
      744:                     <span class=\"ruby-comment cmt\"># the synsets it traverses.</span>\n\
      745:                     <span class=\"ruby-identifier\">traversalFunc</span> = <span class=\"ruby-constant\">Proc</span>.<span class=\"ruby-identifier\">new</span> {<span class=\"ruby-operator\">|</span><span class=\"ruby-identifier\">syn</span>,<span class=\"ruby-identifier\">newDepth</span><span class=\"ruby-operator\">|</span>\n\
      746: \n\
      747:                         <span class=\"ruby-comment cmt\"># Flag to continue traversal</span>\n\
      748:                         <span class=\"ruby-identifier\">haltFlag</span> = <span class=\"ruby-keyword kw\">false</span>\n\
      749: \n\
      750:                         <span class=\"ruby-comment cmt\"># Call the block if it exists and we're either past the origin or</span>\n\
      751:                         <span class=\"ruby-comment cmt\"># including it</span>\n\
      752:                         <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">block_given?</span> <span class=\"ruby-operator\">&amp;&amp;</span> (<span class=\"ruby-identifier\">newDepth</span> <span class=\"ruby-operator\">&gt;</span> <span class=\"ruby-value\">0</span> <span class=\"ruby-operator\">||</span> <span class=\"ruby-identifier\">includeOrigin</span>)\n\
      753:                             <span class=\"ruby-identifier\">res</span> = <span class=\"ruby-keyword kw\">yield</span>( <span class=\"ruby-identifier\">syn</span>, <span class=\"ruby-identifier\">newDepth</span> )\n\
      754:                             <span class=\"ruby-identifier\">haltFlag</span> = <span class=\"ruby-keyword kw\">true</span> <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">res</span>.<span class=\"ruby-identifier\">is_a?</span> <span class=\"ruby-constant\">TrueClass</span>\n\
      755:                         <span class=\"ruby-keyword kw\">end</span>\n\
      756: \n\
      757:                         <span class=\"ruby-comment cmt\"># Make an array for holding sub-synsets we see</span>\n\
      758:                         <span class=\"ruby-identifier\">subSyns</span> = []\n\
      759:                         <span class=\"ruby-identifier\">subSyns</span>.<span class=\"ruby-identifier\">push</span>( <span class=\"ruby-identifier\">syn</span> ) <span class=\"ruby-keyword kw\">unless</span> <span class=\"ruby-identifier\">newDepth</span> <span class=\"ruby-operator\">==</span> <span class=\"ruby-value\">0</span> <span class=\"ruby-operator\">&amp;&amp;</span> <span class=\"ruby-operator\">!</span><span class=\"ruby-identifier\">includeOrigin</span>\n\
      760: \n\
      761:                         <span class=\"ruby-comment cmt\"># Iterate over each synset returned by calling the pointer on the</span>\n\
      762:                         <span class=\"ruby-comment cmt\"># current syn. For each one, we call ourselves recursively, and</span>\n\
      763:                         <span class=\"ruby-comment cmt\"># break out of the iterator with a false value if the block has</span>\n\
      764:                         <span class=\"ruby-comment cmt\"># indicated we should abort by returning a false value.</span>\n\
      765:                         <span class=\"ruby-keyword kw\">unless</span> <span class=\"ruby-identifier\">haltFlag</span>\n\
      766:                             <span class=\"ruby-identifier\">syn</span>.<span class=\"ruby-identifier\">send</span>( <span class=\"ruby-identifier\">type</span> ).<span class=\"ruby-identifier\">each</span> {<span class=\"ruby-operator\">|</span><span class=\"ruby-identifier\">subSyn</span><span class=\"ruby-operator\">|</span>\n\
      767:                                 <span class=\"ruby-identifier\">subSubSyns</span>, <span class=\"ruby-identifier\">haltFlag</span> = <span class=\"ruby-identifier\">traversalFunc</span>.<span class=\"ruby-identifier\">call</span>( <span class=\"ruby-identifier\">subSyn</span>, <span class=\"ruby-identifier\">newDepth</span> <span class=\"ruby-operator\">+</span> <span class=\"ruby-value\">1</span> )\n\
      768:                                 <span class=\"ruby-identifier\">subSyns</span>.<span class=\"ruby-identifier\">push</span>( <span class=\"ruby-operator\">*</span><span class=\"ruby-identifier\">subSubSyns</span> ) <span class=\"ruby-keyword kw\">unless</span> <span class=\"ruby-identifier\">subSubSyns</span>.<span class=\"ruby-identifier\">empty?</span>\n\
      769:                                 <span class=\"ruby-keyword kw\">break</span> <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">haltFlag</span>\n\
      770:                             }\n\
      771:                         <span class=\"ruby-keyword kw\">end</span>\n\
      772: \n\
      773:                         <span class=\"ruby-comment cmt\"># return</span>\n\
      774:                         [ <span class=\"ruby-identifier\">subSyns</span>, <span class=\"ruby-identifier\">haltFlag</span> ]\n\
      775:                     }\n\
      776: \n\
      777:                     <span class=\"ruby-comment cmt\"># Call the iterator</span>\n\
      778:                     <span class=\"ruby-identifier\">traversedSets</span>, <span class=\"ruby-identifier\">haltFlag</span> =  <span class=\"ruby-identifier\">traversalFunc</span>.<span class=\"ruby-identifier\">call</span>( <span class=\"ruby-keyword kw\">self</span>, <span class=\"ruby-identifier\">depth</span> )\n\
      779: \n\
      780:                     <span class=\"ruby-comment cmt\"># If a block was given, just return whether or not the block was halted.</span>\n\
      781:                     <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">block_given?</span>\n\
      782:                         <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-identifier\">haltFlag</span>\n\
      783: \n\
      784:                         <span class=\"ruby-comment cmt\"># If no block was given, return the traversed synsets</span>\n\
      785:                     <span class=\"ruby-keyword kw\">else</span>\n\
      786:                         <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-identifier\">traversedSets</span>\n\
      787:                     <span class=\"ruby-keyword kw\">end</span>\n\
      788:                 <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Traversal iterator: Iterates depth-first over a particular <tt>type</tt> of
      the receiver, and all of the pointed-to synset&#8216;s pointers. If called
      with a block, the block is called once for each synset with the
      <tt>foundSyn</tt> and its <tt>depth</tt> in relation to the originating
      synset as arguments. The first call will be the originating synset with a
      depth of <tt>0</tt> unless <tt>includeOrigin</tt> is <tt>false</tt>. If the
      <tt>callback</tt> returns <tt>true</tt>, the traversal is halted, and the
      method returns immediately. This method returns an Array of the synsets
      which were traversed if no block is given, or a flag which indicates
      whether or not the traversal was interrupted if a block is given.
      </p>
    params: ( type, includeOrigin=true ) {|syn, newDepth| ...}
  - visibility: public
    aref: M000027
    name: words
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/wordnet/synset.rb, line 415</span>\n\
      415:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">words</span>\n\
      416:             <span class=\"ruby-ivar\">@mutex</span>.<span class=\"ruby-identifier\">synchronize</span>( <span class=\"ruby-constant\">Sync</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">SH</span> ) {\n\
      417:                 <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">wordlist</span>.<span class=\"ruby-identifier\">split</span>( <span class=\"ruby-constant\">SUB_DELIM_RE</span> ).<span class=\"ruby-identifier\">collect</span> <span class=\"ruby-keyword kw\">do</span> <span class=\"ruby-operator\">|</span><span class=\"ruby-identifier\">word</span><span class=\"ruby-operator\">|</span>\n\
      418:                     <span class=\"ruby-identifier\">word</span>.<span class=\"ruby-identifier\">gsub</span>( <span class=\"ruby-regexp re\">/_/</span>, <span class=\"ruby-value str\">' '</span> ).<span class=\"ruby-identifier\">sub</span>( <span class=\"ruby-regexp re\">/%.*$/</span>, <span class=\"ruby-value str\">''</span> )\n\
      419:                 <span class=\"ruby-keyword kw\">end</span>\n\
      420:             }\n\
      421:         <span class=\"ruby-keyword kw\">end</span>"
    aka: 
    - aref: Synset.html#M000028
      name: synonyms
    m_desc: |-
      <p>
      Returns an Array of words and/or collocations associated with this synset.
      </p>
    params: ()
  - visibility: public
    aref: M000029
    name: words=
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/wordnet/synset.rb, line 426</span>\n\
      426:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">words=</span>( <span class=\"ruby-operator\">*</span><span class=\"ruby-identifier\">newWords</span> )\n\
      427:             <span class=\"ruby-ivar\">@mutex</span>.<span class=\"ruby-identifier\">synchronize</span>( <span class=\"ruby-constant\">Sync</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">EX</span> ) {\n\
      428:                 <span class=\"ruby-ivar\">@wordlist</span> = <span class=\"ruby-identifier\">newWords</span>.<span class=\"ruby-identifier\">join</span>( <span class=\"ruby-constant\">SUB_DELIM</span> )\n\
      429:             }\n\
      430:         <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Set the words in this synset&#8216;s wordlist to <tt>newWords</tt>
      </p>
    params: ( *newWords )
  - visibility: public
    aref: M000035
    name: write
    m_desc: |-
      <p>
      Alias for <a href="Synset.html#M000034">#store</a>
      </p>
    params: ()
  - visibility: public
    aref: M000045
    name: "|"
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/wordnet/synset.rb, line 818</span>\n\
      818:                 <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-operator\">|</span>( <span class=\"ruby-identifier\">otherSyn</span> )\n\
      819: \n\
      820:                     <span class=\"ruby-comment cmt\"># Find all of this syn's hypernyms</span>\n\
      821:                     <span class=\"ruby-identifier\">hyperSyns</span> = <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">traverse</span>( <span class=\"ruby-identifier\">:hypernyms</span> )\n\
      822:                     <span class=\"ruby-identifier\">commonSyn</span> = <span class=\"ruby-keyword kw\">nil</span>\n\
      823: \n\
      824:                     <span class=\"ruby-comment cmt\"># Now traverse the other synset's hypernyms looking for one of our</span>\n\
      825:                     <span class=\"ruby-comment cmt\"># own hypernyms.</span>\n\
      826:                     <span class=\"ruby-identifier\">otherSyn</span>.<span class=\"ruby-identifier\">traverse</span>( <span class=\"ruby-identifier\">:hypernyms</span> ) {<span class=\"ruby-operator\">|</span><span class=\"ruby-identifier\">syn</span>,<span class=\"ruby-identifier\">depth</span><span class=\"ruby-operator\">|</span>\n\
      827:                         <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">hyperSyns</span>.<span class=\"ruby-identifier\">include?</span>( <span class=\"ruby-identifier\">syn</span> )\n\
      828:                             <span class=\"ruby-identifier\">commonSyn</span> = <span class=\"ruby-identifier\">syn</span>\n\
      829:                             <span class=\"ruby-keyword kw\">true</span>\n\
      830:                         <span class=\"ruby-keyword kw\">end</span>\n\
      831:                     }\n\
      832: \n\
      833:                     <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-identifier\">commonSyn</span>\n\
      834:                 <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Union: Return the least general synset that the receiver and
      <tt>otherSynset</tt> have in common as a hypernym, or nil if it
      doesn&#8216;t share any.
      </p>
    params: ( otherSyn )
  category: Instance
  type: Public
- methods: 
  - visibility: protected
    aref: M000049
    name: fetch_synset_pointers
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/wordnet/synset.rb, line 876</span>\n\
      876:                     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">fetch_synset_pointers</span>( <span class=\"ruby-identifier\">type</span>, <span class=\"ruby-identifier\">subtype</span>=<span class=\"ruby-keyword kw\">nil</span> )\n\
      877:                         <span class=\"ruby-identifier\">synsets</span> = <span class=\"ruby-keyword kw\">nil</span>\n\
      878: \n\
      879:                         <span class=\"ruby-comment cmt\"># Iterate over this synset's pointers, looking for ones that match</span>\n\
      880:                         <span class=\"ruby-comment cmt\"># the type we're after. When we find one, we extract its offset and</span>\n\
      881:                         <span class=\"ruby-comment cmt\"># use that to look it up.</span>\n\
      882:                         <span class=\"ruby-ivar\">@mutex</span>.<span class=\"ruby-identifier\">synchronize</span>( <span class=\"ruby-constant\">Sync</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">SH</span> ) <span class=\"ruby-keyword kw\">do</span>\n\
      883:                             <span class=\"ruby-identifier\">synsets</span> = <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">pointers</span>.\n\
      884:                             <span class=\"ruby-identifier\">find_all</span> {<span class=\"ruby-operator\">|</span><span class=\"ruby-identifier\">ptr</span><span class=\"ruby-operator\">|</span>\n\
      885:                                 <span class=\"ruby-identifier\">ptr</span>.<span class=\"ruby-identifier\">type</span> <span class=\"ruby-operator\">==</span> <span class=\"ruby-identifier\">type</span> <span class=\"ruby-keyword kw\">and</span>\n\
      886:                                 <span class=\"ruby-identifier\">subtype</span>.<span class=\"ruby-identifier\">nil?</span> <span class=\"ruby-operator\">||</span> <span class=\"ruby-identifier\">ptr</span>.<span class=\"ruby-identifier\">subtype</span> <span class=\"ruby-operator\">==</span> <span class=\"ruby-identifier\">subtype</span>\n\
      887:                                 }.\n\
      888:                                 <span class=\"ruby-identifier\">collect</span> {<span class=\"ruby-operator\">|</span><span class=\"ruby-identifier\">ptr</span><span class=\"ruby-operator\">|</span> <span class=\"ruby-identifier\">ptr</span>.<span class=\"ruby-identifier\">synset</span> }.\n\
      889:                                 <span class=\"ruby-identifier\">collect</span> {<span class=\"ruby-operator\">|</span><span class=\"ruby-identifier\">key</span><span class=\"ruby-operator\">|</span> <span class=\"ruby-ivar\">@lexicon</span>.<span class=\"ruby-identifier\">lookup_synsets_by_key</span>( <span class=\"ruby-identifier\">key</span> )}\n\
      890:                             <span class=\"ruby-keyword kw\">end</span>\n\
      891: \n\
      892:                             <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-identifier\">synsets</span>.<span class=\"ruby-identifier\">flatten</span>\n\
      893:                         <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Returns an Array of synset objects for the receiver&#8216;s pointers of the
      specified <tt>type</tt>.
      </p>
    params: ( type, subtype=nil )
  - visibility: protected
    aref: M000050
    name: set_synset_pointers
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/wordnet/synset.rb, line 898</span>\n\
      898:                         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">set_synset_pointers</span>( <span class=\"ruby-identifier\">type</span>, <span class=\"ruby-identifier\">synsets</span>, <span class=\"ruby-identifier\">subtype</span>=<span class=\"ruby-keyword kw\">nil</span> )\n\
      899:                             <span class=\"ruby-identifier\">synsets</span> = [ <span class=\"ruby-identifier\">synsets</span> ] <span class=\"ruby-keyword kw\">unless</span> <span class=\"ruby-identifier\">synsets</span>.<span class=\"ruby-identifier\">is_a?</span>( <span class=\"ruby-constant\">Array</span> )\n\
      900:                             <span class=\"ruby-identifier\">pmap</span> = <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">pointer_map</span>\n\
      901:                             <span class=\"ruby-identifier\">pmap</span>[ <span class=\"ruby-identifier\">type</span> ] = <span class=\"ruby-identifier\">synsets</span>\n\
      902:                             <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">pointers</span> = <span class=\"ruby-identifier\">pmap</span>.<span class=\"ruby-identifier\">values</span>\n\
      903:                         <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Sets the receiver&#8216;s synset pointers for the specified <tt>type</tt>
      to the specified <tt>synsets</tt>.
      </p>
    params: ( type, synsets, subtype=nil )
  category: Instance
  type: Protected

sectitle

--- 

constants

--- 
- name: SVNId
  desc: |+
    
    Subversion ID
    
  value: "%q$Id: synset.rb 90 2008-07-09 23:02:53Z deveiant $"
- name: SVNRev
  desc: |+
    
    Subversion Rev
    
  value: "%q$Rev: 90 $"

[Validate]

Generated with the Darkfish Rdoc Generator.