nebrija 0.0.4 → 0.1.0
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/nebrija/parser.rb +9 -4
- data/lib/nebrija.rb +1 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c47fc0ec9b7e9e319a74a0af79a39689626025c
|
4
|
+
data.tar.gz: 36c7a4493aee48ce724bcbc600468847d51370df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d2d58e5c86345726849f0e44841c38634a88ef096d55caf4515c3cf9019411cb91897ad0ff2d81051ec5b4c8926049c02eb394e45ead96f2196c13e05d60538
|
7
|
+
data.tar.gz: e5108b63017f9eb3b253844dcaef2f72d7958908ca9b9c990811b19f8c740ec949794abf5475b2a8658ea8ecbe40cffc6f932f1940a97b5edbfd449ce3448c37
|
data/lib/nebrija/parser.rb
CHANGED
@@ -33,17 +33,22 @@ class Parser
|
|
33
33
|
word = '=>' if word == ''
|
34
34
|
single_data << {
|
35
35
|
:word => word.strip.capitalize, # gsub(/~/, @word)
|
36
|
-
:meanings => []
|
36
|
+
:meanings => [],
|
37
|
+
:etymology => nil
|
37
38
|
}
|
38
39
|
index+=1
|
39
40
|
else
|
40
41
|
text = entry.inner_text.strip.gsub(/[0-9]+\.[ ]/, '')
|
41
|
-
|
42
|
+
if text[0] == '('
|
43
|
+
single_data[index][:etymology] = text
|
44
|
+
next
|
45
|
+
end
|
46
|
+
|
42
47
|
unparsed_meta = text.scan META_REGEX
|
43
48
|
text = text.gsub(META_REGEX, '')
|
44
49
|
single_data[index][:meanings] << {
|
45
|
-
:word
|
46
|
-
:meta
|
50
|
+
:word => text,
|
51
|
+
:meta => (unparsed_meta.join.strip if unparsed_meta.join.strip != ''),
|
47
52
|
} if !text.nil? and text != ''
|
48
53
|
state = :definitions
|
49
54
|
end
|
data/lib/nebrija.rb
CHANGED
@@ -27,7 +27,6 @@ end
|
|
27
27
|
class HTTPRae < Rae
|
28
28
|
USER_AGENT = 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36'
|
29
29
|
SEARCH_URL = 'http://lema.rae.es/drae/srv/search?'
|
30
|
-
REQUEST_TIMEOUT =
|
31
30
|
ID_REGEX = /[0-9]/
|
32
31
|
|
33
32
|
private
|
@@ -38,7 +37,7 @@ class HTTPRae < Rae
|
|
38
37
|
params = 'val=' if val?
|
39
38
|
|
40
39
|
response = Typhoeus::Request.post(
|
41
|
-
"
|
40
|
+
"#{SEARCH_URL}#{params}#{word}",
|
42
41
|
body: build_headers
|
43
42
|
)
|
44
43
|
response.body
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nebrija
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- '@javierhonduco'
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|