descartes 0.3.10 → 0.3.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/descartes +3 -3
- data/lib/descartes/modules/google.rb +2 -1
- data/lib/descartes/modules/reply.rb +2 -2
- data/lib/descartes/modules/synonyms.rb +9 -5
- data/lib/descartes/modules/trec.rb +8 -6
- data/lib/descartes/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b97d6e88d2d8d305260597381a92dc1fce44ba5e
|
|
4
|
+
data.tar.gz: 7c3f14df7602df31530c8a0c003996fb6f2dd2ea
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9acacb1bc7e1c033a20a6700e09a41dce15425adc2b52946026111006e136363e29eea399cb2d93dce9a221883cb21e43ef4fe602bd43856bf4f56961727dd50
|
|
7
|
+
data.tar.gz: 2fab6c8bfdb25f3ca841cce301d6ee21ec2761c08eaf47a8831822b1ee97f11f18ae77b47f36d71d1f5fda9524991b7ff07278606e8c1b76cc78f08feaae291f
|
data/bin/descartes
CHANGED
|
@@ -16,14 +16,14 @@
|
|
|
16
16
|
|
|
17
17
|
require 'descartes'
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
nickname = ARGV[0] || 'Descartes'
|
|
20
20
|
server = ARGV[1] || 'irc.rizon.net'
|
|
21
21
|
channels = ARGV[2..-1] || ['#aggvistnurummor']
|
|
22
22
|
plugins = Descartes.load
|
|
23
23
|
|
|
24
24
|
Cinch::Bot.new {
|
|
25
25
|
configure do |c|
|
|
26
|
-
c.nick =
|
|
26
|
+
c.nick = nickname
|
|
27
27
|
c.realname = 'Descartes'
|
|
28
28
|
c.user = 'Descartes'
|
|
29
29
|
c.server = server
|
|
@@ -46,7 +46,7 @@ Cinch::Bot.new {
|
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
on :message, '!"' do |m|
|
|
49
|
-
m.reply '
|
|
49
|
+
m.reply '“…”'
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
}.start
|
|
@@ -18,12 +18,16 @@ require 'open-uri'
|
|
|
18
18
|
class Descartes
|
|
19
19
|
class Synonyms
|
|
20
20
|
include Cinch::Plugin
|
|
21
|
-
match /syn (
|
|
21
|
+
match /syn (.+)/
|
|
22
22
|
|
|
23
|
-
def execute(m, word)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
def execute(m, word) # search synonyms of a term in the most famous italian vocabulary
|
|
24
|
+
begin
|
|
25
|
+
url = "http://www.treccani.it/vocabolario/#{word}_(Sinonimi-e-Contrari)/"
|
|
26
|
+
page = Nokogiri::HTML(open(url))
|
|
27
|
+
m.reply page.at_xpath('//div[@class="spiega attacco"]/p').text.strip + " di più qui: #{url}"
|
|
28
|
+
rescue
|
|
29
|
+
m.reply 'Vocabolo non trovato.'
|
|
30
|
+
end
|
|
27
31
|
end
|
|
28
32
|
end
|
|
29
33
|
end
|
|
@@ -15,17 +15,19 @@
|
|
|
15
15
|
require 'nokogiri'
|
|
16
16
|
require 'open-uri'
|
|
17
17
|
|
|
18
|
-
|
|
19
18
|
class Descartes
|
|
20
19
|
class Treccani
|
|
21
20
|
include Cinch::Plugin
|
|
21
|
+
match /trec (.+)/
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
def execute(m, word)
|
|
26
|
-
url = "http://www.treccani.it/vocabolario/tag/#{word}"
|
|
23
|
+
def execute(m, word) # search the meaning of a term in the most famous italian vocabulary
|
|
24
|
+
url = "http://www.treccani.it/vocabolario/tag/#{word}"
|
|
27
25
|
page = Nokogiri::HTML(open(url))
|
|
28
|
-
|
|
26
|
+
unless page.at_xpath('//div[@class="intro"]').text.include? 'prodotto alcun risultato'
|
|
27
|
+
m.reply page.at_xpath('//li[@class="result fs"]/p').text.strip + " di più qui: #{url}"
|
|
28
|
+
else
|
|
29
|
+
m.reply 'Vocabolo non trovato.'
|
|
30
|
+
end
|
|
29
31
|
end
|
|
30
32
|
end
|
|
31
33
|
end
|
data/lib/descartes/version.rb
CHANGED