aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--railties/CHANGELOG2
-rw-r--r--railties/lib/rails_generator/commands.rb6
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("&nbsp;", " ").gsub("<BR>", "")
- data.scan(/^Sense \d+\n.+?\n\n/m)
+ # Grab words linked to dictionary entries as possible synonyms
+ data = stream.read.gsub("&nbsp;", " ").scan(/<a href="webwn.*?">([\w ]*?)<\/a>/s).uniq
end
end
rescue Exception