PearsonLongman-Dictionary 0.3.0 → 0.4.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e94215192f6626d3a21eeebbb2bbc8fec66a4997
|
4
|
+
data.tar.gz: c5f3ee23608fe9f41ce216ef0809604240519e7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5cf9c6c1e7fd38b9ac0a0b157db18f3d45888f41ff48a38e607aa771f8cd2dade00b8a2178e6a1cda0f488cc3a1bc4554377cb9279c870f492631cce7cb2093
|
7
|
+
data.tar.gz: 1bfcaca51013a0727df4d23e23d8ad2804394f49458a9403a1692067e6befbce1ac6b83d33c47fac869a16196f5be4f09d82a665ad40155b4de21982497fdd57
|
@@ -1,13 +1,14 @@
|
|
1
1
|
module DictionaryLookup
|
2
2
|
class Definition
|
3
|
-
attr_accessor :headword, :part_of_speech, :denotation, :examples, :pronunciations
|
3
|
+
attr_accessor :headword, :part_of_speech, :denotation, :examples, :pronunciations, :entries
|
4
4
|
|
5
|
-
def initialize(headword, part_of_speech, denotation, examples, pronunciations)
|
5
|
+
def initialize(headword, part_of_speech, denotation, examples, pronunciations, entries)
|
6
6
|
@headword = headword
|
7
7
|
@part_of_speech = part_of_speech
|
8
8
|
@denotation = denotation
|
9
9
|
@examples = examples
|
10
10
|
@pronunciations = pronunciations
|
11
|
+
@entries = entries
|
11
12
|
end
|
12
13
|
end
|
13
14
|
end
|
@@ -33,14 +33,15 @@ module DictionaryLookup
|
|
33
33
|
data = JSON.parse(response)
|
34
34
|
|
35
35
|
# Select definitions that match exactly with the term
|
36
|
-
results = data["results"].select{ |d|
|
36
|
+
results = data["results"].select{ |d|
|
37
37
|
d["headword"].downcase == term.downcase or d["headword"].downcase[0,term.length+1] == term.downcase + ","
|
38
38
|
}
|
39
39
|
definitions = []
|
40
|
-
|
40
|
+
puts results
|
41
41
|
results.each do |result|
|
42
42
|
headword = result["headword"]
|
43
43
|
part_of_speech = result["part_of_speech"]
|
44
|
+
entries = result["url"]
|
44
45
|
# In wordwise dictionary, value of definition is String. Hence the is_a? test
|
45
46
|
_definitions = result["senses"].first["definition"]
|
46
47
|
denotation = _definitions.is_a?(Array) ? _definitions.first : _definitions
|
@@ -54,7 +55,7 @@ module DictionaryLookup
|
|
54
55
|
else
|
55
56
|
pronunciations = result["pronunciations"].first["audio"].map{|e| e["url"]}
|
56
57
|
end
|
57
|
-
definitions << DictionaryLookup::Definition.new(headword, part_of_speech, denotation, examples, pronunciations)
|
58
|
+
definitions << DictionaryLookup::Definition.new(headword, part_of_speech, denotation, examples, pronunciations, entries)
|
58
59
|
end
|
59
60
|
|
60
61
|
definitions
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: PearsonLongman-Dictionary
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arnold Tonderai Marunda
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -38,8 +38,8 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '5.0'
|
41
|
-
description: Retrieves word definitions,
|
42
|
-
|
41
|
+
description: Retrieves word definitions, countries and personalities. Provides word,
|
42
|
+
type, denotation and pronunciation
|
43
43
|
email: arnold-fungai@live.com
|
44
44
|
executables: []
|
45
45
|
extensions: []
|