PearsonLongman-Dictionary 0.2.0 → 0.3.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: 2b947b6f16eb32d7b908939d71eebc17564231a2
4
- data.tar.gz: 42f61477519df7f616d7f6e3afb78c5cbf073c69
3
+ metadata.gz: 884b2b77ab4bf5c97d728d983fd8e5641005a06f
4
+ data.tar.gz: d59d0b6927d3993959f3de5d3f976124d9193f5d
5
5
  SHA512:
6
- metadata.gz: dcfed083200cd58bbdf0c03c3d6745c501cb8843821f6b73ebf0f44265202a2378317d57949e953be53bcc1b91b24cf2a2de84cd62c7e91f41c5e2a314c5c055
7
- data.tar.gz: afeb2d2f07584f3732bd1fc4a3c628bc3957aa60afab7f9901d7ade5a3417ad9bfaa435c94be96db3092137a92e3919b5a50568af3526ebc0d802978de36d6a8
6
+ metadata.gz: 5eaadf61a3fb05cbf6113b95146f37d2cbd7afca9bc22b2ef21f9934ab7fe4b53e0e16318449d2dc8919062060243e757268139cdccdce08d974727d084c48bc
7
+ data.tar.gz: 6a3469beaab735eba03a4643d774ef354ad359a14102e6f1db704479999f79c1681ea6e296f030de8fbd8cddb0afbb9d72d9c6adb8885275a3e9224044d45bce
data/README.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
 
4
4
  A ruby gem that wraps [Pearson dictionary API](http://developer.pearson.com/apis/dictionaries)
5
+ that retrieves:- word/object definitions, and country/famous person profiles.
6
+
7
+ For Live Demo> Use Twitter Bot - [@opentxtbook] (https://www.twitter.com/opentxtbook) - A Personal Learning Assistant
8
+ A #botally new way to #creativeLEARNINGdifferent! To 🚀launch, send Direct Message> !start
5
9
 
6
10
  ## Getting started
7
11
 
@@ -17,9 +21,9 @@ You can install it directly
17
21
  gem install pearsonlongman-dictionary
18
22
 
19
23
  and then require it
20
-
24
+ ```ruby
21
25
  require 'pearsonlongman-dictionary'
22
-
26
+ ```
23
27
  ## Usage
24
28
 
25
29
  You can lookup a word definition by:
@@ -31,6 +35,7 @@ results = DictionaryLookup::Base.define("hello")
31
35
  results will contain an array of DictionaryLookup::Definition objects.
32
36
  ```ruby
33
37
  results.count # => 1
38
+ results.first.headword # => "hello"
34
39
  results.first.part_of_speech # => "noun"
35
40
  results.first.denotation # => "used as a greeting when you see or meet someone"
36
41
  results.first.examples # => ["Hello, John! How are you?"]
@@ -1,12 +1,13 @@
1
1
  module DictionaryLookup
2
2
  class Definition
3
- attr_accessor :headword, :part_of_speech, :denotation, :examples
3
+ attr_accessor :headword, :part_of_speech, :denotation, :examples, :pronunciations
4
4
 
5
- def initialize(headword, part_of_speech, denotation, examples)
5
+ def initialize(headword, part_of_speech, denotation, examples, pronunciations)
6
6
  @headword = headword
7
7
  @part_of_speech = part_of_speech
8
8
  @denotation = denotation
9
9
  @examples = examples
10
+ @pronunciations = pronunciations
10
11
  end
11
12
  end
12
13
  end
@@ -35,7 +35,6 @@ module DictionaryLookup
35
35
  # Select definitions that match exactly with the term
36
36
  results = data["results"].select{ |d| dhead = d["headword"].downcase
37
37
  d["headword"].downcase == term.downcase or d["headword"].downcase[0,term.length+1] == term.downcase + ","
38
- # d["headword"].downcase == term.downcase or dhead[term.length] == ","
39
38
  }
40
39
  definitions = []
41
40
 
@@ -50,7 +49,12 @@ module DictionaryLookup
50
49
  else
51
50
  examples = result["senses"].first["examples"].map{|e| e["text"]}
52
51
  end
53
- definitions << DictionaryLookup::Definition.new(headword, part_of_speech, denotation, examples)
52
+ if result["pronunciations"].nil?
53
+ pronunciations = []
54
+ else
55
+ pronunciations = result["pronunciations"].first["audio"].map{|e| e["url"]}
56
+ end
57
+ definitions << DictionaryLookup::Definition.new(headword, part_of_speech, denotation, examples, pronunciations)
54
58
  end
55
59
 
56
60
  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.2.0
4
+ version: 0.3.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-06-25 00:00:00.000000000 Z
11
+ date: 2016-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -38,7 +38,8 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '5.0'
41
- description: Retrieves word definitions, country and famous person profiles
41
+ description: Retrieves word definitions, country and famous person profiles. Provides
42
+ word, type, denotation and pronunciation
42
43
  email: arnold-fungai@live.com
43
44
  executables: []
44
45
  extensions: []