diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2008-01-10 02:50:43 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2008-01-10 02:50:43 +0000 |
commit | 3642a4d6f88d774b56cf82d111179c1743065015 (patch) | |
tree | 7f0640bee17553fe5c4f3978acf77d6380cac8d5 /railties | |
parent | f05b870ae0c664e061b54482bdb900fb6184fcda (diff) | |
download | rails-3642a4d6f88d774b56cf82d111179c1743065015.tar.gz rails-3642a4d6f88d774b56cf82d111179c1743065015.tar.bz2 rails-3642a4d6f88d774b56cf82d111179c1743065015.zip |
Resurrect WordNet synonym lookups. Closes #10710.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8615 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties')
-rw-r--r-- | railties/CHANGELOG | 2 | ||||
-rw-r--r-- | railties/lib/rails_generator/commands.rb | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG index f1c8b0abd1..9bf31b0d55 100644 --- a/railties/CHANGELOG +++ b/railties/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Resurrect WordNet synonym lookups. #10710 [tom./, matt] + * 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] * Added that rails:update is run when you do rails:freeze:edge to ensure you also get the latest JS and config files #10565 [jeff] diff --git a/railties/lib/rails_generator/commands.rb b/railties/lib/rails_generator/commands.rb index cbedd36d0e..f6e503282d 100644 --- a/railties/lib/rails_generator/commands.rb +++ b/railties/lib/rails_generator/commands.rb @@ -391,7 +391,7 @@ end_message raise UsageError, message end - SYNONYM_LOOKUP_URI = "http://wordnet.princeton.edu/cgi-bin/webwn2.0?stage=2&word=%s&posnumber=1&searchtypenumber=2&senses=&showglosses=1" + SYNONYM_LOOKUP_URI = "http://wordnet.princeton.edu/perl/webwn?s=%s" # Look up synonyms on WordNet. Thanks to Florian Gross (flgr). def find_synonyms(word) @@ -399,8 +399,8 @@ end_message require 'timeout' timeout(5) do open(SYNONYM_LOOKUP_URI % word) do |stream| - data = stream.read.gsub(" ", " ").gsub("<BR>", "") - data.scan(/^Sense \d+\n.+?\n\n/m) + # Grab words linked to dictionary entries as possible synonyms + data = stream.read.gsub(" ", " ").scan(/<a href="webwn.*?">([\w ]*?)<\/a>/s).uniq end end rescue Exception |