descartes 0.3.11 → 0.3.12
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/lib/descartes/modules/treccani.rb +58 -0
- data/lib/descartes/version.rb +1 -1
- metadata +16 -3
- data/lib/descartes/modules/synonyms.rb +0 -33
- data/lib/descartes/modules/trec.rb +0 -33
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 634c0cfd23a887e6eb8fe17f918380346022f097
|
|
4
|
+
data.tar.gz: 33c225011be954c5cc93881de00193df8d805ae2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e4610faff31930c5678ae26ebf3a3e1a53ed5f26d10cc76a910880079925db3213546152cb6b20b35f42bfa4f46f2b83aae663110cc88f58b6b9f8618734a82c
|
|
7
|
+
data.tar.gz: 247aaa2a57e3b67257b17ae120462b9c73bb09648f7735288d77aa029ab90bc387570bda9a24c383471ae27120753d1897a86fcae90f5afd49aacc482757abbc
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
##
|
|
3
|
+
## DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
|
4
|
+
## Version 2, December 2004
|
|
5
|
+
##
|
|
6
|
+
## Everyone is permitted to copy and distribute verbatim or modified
|
|
7
|
+
## copies of this license document, and changing it is allowed as long
|
|
8
|
+
## as the name is changed.
|
|
9
|
+
##
|
|
10
|
+
## DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
|
11
|
+
## TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
|
12
|
+
##
|
|
13
|
+
## 0. You just DO WHAT THE FUCK YOU WANT TO.
|
|
14
|
+
##
|
|
15
|
+
require 'treccani'
|
|
16
|
+
|
|
17
|
+
class Descartes
|
|
18
|
+
class Treccani
|
|
19
|
+
include Cinch::Plugin
|
|
20
|
+
set :prefix, '!trec '
|
|
21
|
+
|
|
22
|
+
match 'cit', method: :citazione
|
|
23
|
+
match /enc (.+)/, method: :enciclopedia
|
|
24
|
+
match /syn (.+)/, method: :sinonimi
|
|
25
|
+
match /voc (.+)/, method: :vocabolario
|
|
26
|
+
|
|
27
|
+
def citazione(m)
|
|
28
|
+
treccani = Treccani::Citazione.new.get
|
|
29
|
+
m.reply "#{treccani[:citazione]} - #{treccani[:autore]}"
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def enciclopedia(m, word)
|
|
33
|
+
begin
|
|
34
|
+
m.reply Treccani::Enciclopedia.new.get(word)[:meanings].first[0..400]
|
|
35
|
+
m.reply "- #{Treccani::Enciclopedia.new.get_url word}"
|
|
36
|
+
rescue
|
|
37
|
+
m.reply 'Vocabolo non trovato.'
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def sinonimi(m, word)
|
|
42
|
+
begin
|
|
43
|
+
m.reply Treccani::Sinonimi.new.get word
|
|
44
|
+
rescue
|
|
45
|
+
m.reply 'Vocabolo non trovato.'
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def vocabolario(m, word)
|
|
50
|
+
begin
|
|
51
|
+
m.reply Treccani::Vocabolario.new.get(word)[:meanings].first[0..400]
|
|
52
|
+
m.reply "- #{Treccani::Vocabolario.new.get_url word}"
|
|
53
|
+
rescue
|
|
54
|
+
m.reply 'Vocabolo non trovato.'
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
data/lib/descartes/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: descartes
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.12
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Giovanni Capuano
|
|
@@ -94,6 +94,20 @@ dependencies:
|
|
|
94
94
|
- - ">="
|
|
95
95
|
- !ruby/object:Gem::Version
|
|
96
96
|
version: '0'
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: treccani
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - ">="
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '0'
|
|
104
|
+
type: :runtime
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - ">="
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: '0'
|
|
97
111
|
description: A serious modular ruby IRC bot.
|
|
98
112
|
email: webmaster@giovannicapuano.net
|
|
99
113
|
executables:
|
|
@@ -114,8 +128,7 @@ files:
|
|
|
114
128
|
- lib/descartes/modules/seen.rb
|
|
115
129
|
- lib/descartes/modules/shinbo.rb
|
|
116
130
|
- lib/descartes/modules/sindaco.rb
|
|
117
|
-
- lib/descartes/modules/
|
|
118
|
-
- lib/descartes/modules/trec.rb
|
|
131
|
+
- lib/descartes/modules/treccani.rb
|
|
119
132
|
- lib/descartes/modules/url.rb
|
|
120
133
|
- lib/descartes/utils.rb
|
|
121
134
|
- lib/descartes/version.rb
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# encoding: UTF-8
|
|
2
|
-
# ##
|
|
3
|
-
# ## DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
|
4
|
-
# ## Version 2, December 2004
|
|
5
|
-
# ##
|
|
6
|
-
# ## Everyone is permitted to copy and distribute verbatim or modified
|
|
7
|
-
# ## copies of this license document, and changing it is allowed as long
|
|
8
|
-
# ## as the name is changed.
|
|
9
|
-
# ##
|
|
10
|
-
# ## DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
|
11
|
-
# ## TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
|
12
|
-
# ##
|
|
13
|
-
# ## 0. You just DO WHAT THE FUCK YOU WANT TO.
|
|
14
|
-
# ##
|
|
15
|
-
require 'nokogiri'
|
|
16
|
-
require 'open-uri'
|
|
17
|
-
|
|
18
|
-
class Descartes
|
|
19
|
-
class Synonyms
|
|
20
|
-
include Cinch::Plugin
|
|
21
|
-
match /syn (.+)/
|
|
22
|
-
|
|
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
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
end
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# encoding: UTF-8
|
|
2
|
-
##
|
|
3
|
-
## DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
|
4
|
-
## Version 2, December 2004
|
|
5
|
-
##
|
|
6
|
-
## Everyone is permitted to copy and distribute verbatim or modified
|
|
7
|
-
## copies of this license document, and changing it is allowed as long
|
|
8
|
-
## as the name is changed.
|
|
9
|
-
##
|
|
10
|
-
## DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
|
11
|
-
## TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
|
12
|
-
##
|
|
13
|
-
## 0. You just DO WHAT THE FUCK YOU WANT TO.
|
|
14
|
-
##
|
|
15
|
-
require 'nokogiri'
|
|
16
|
-
require 'open-uri'
|
|
17
|
-
|
|
18
|
-
class Descartes
|
|
19
|
-
class Treccani
|
|
20
|
-
include Cinch::Plugin
|
|
21
|
-
match /trec (.+)/
|
|
22
|
-
|
|
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}"
|
|
25
|
-
page = Nokogiri::HTML(open(url))
|
|
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
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
end
|