Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 8615

Show
Ignore:
Timestamp:
01/10/08 02:50:43 (6 months ago)
Author:
bitsweat
Message:

Resurrect WordNet synonym lookups. Closes #10710.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/railties/CHANGELOG

    r8546 r8615  
    11*SVN* 
     2 
     3* Resurrect WordNet synonym lookups.  #10710 [tom./, matt] 
    24 
    35* Added config.cache_store to environment options to control the default cache store (default is FileStore if tmp/cache is present, otherwise MemoryStore is used) [DHH] 
  • trunk/railties/lib/rails_generator/commands.rb

    r8527 r8615  
    392392          end 
    393393 
    394           SYNONYM_LOOKUP_URI = "http://wordnet.princeton.edu/cgi-bin/webwn2.0?stage=2&word=%s&posnumber=1&searchtypenumber=2&senses=&showglosses=1
     394          SYNONYM_LOOKUP_URI = "http://wordnet.princeton.edu/perl/webwn?s=%s
    395395 
    396396          # Look up synonyms on WordNet.  Thanks to Florian Gross (flgr). 
     
    400400            timeout(5) do 
    401401              open(SYNONYM_LOOKUP_URI % word) do |stream| 
    402                 data = stream.read.gsub("&nbsp;", " ").gsub("<BR>", "") 
    403                 data.scan(/^Sense \d+\n.+?\n\n/m) 
     402                # Grab words linked to dictionary entries as possible synonyms 
     403                data = stream.read.gsub("&nbsp;", " ").scan(/<a href="webwn.*?">([\w ]*?)<\/a>/s).uniq 
    404404              end 
    405405            end