nitishparkar / dictionary-lookup-rb Goto Github PK
View Code? Open in Web Editor NEWA ruby gem that wraps pearson dictionary API
License: MIT License
A ruby gem that wraps pearson dictionary API
License: MIT License
Hi @nitishparkar , got another issue to pick your brain :)
In pearson.rb
, the line 36 results = data["results"].select{ |d| d["headword"].downcase == term.downcase }
is useful in eliminating a lot of the less relevant entries.
However, it is eliminating some very relevant entries, especially of people and places. e.g Barack Obama, Michael Jackson, or The Philippines.
This is because the Pearson API headword
format for
obama, barack
will not equal lookup term obama
philippines, the
will not equal lookup term philippines
As a ruby newbie I don't know the best way to resolve this. My initial thoughts are to alter line 36 as follows; results = data["results"].select{ |d| dhead = d["headword"].downcase d["headword"].downcase == term.downcase or d["headword"].downcase[0,term.length+1] == term.downcase + "," }.
This caters for above mentioned headword format as I noticed that Pearson place a ,
after such entries.
I was using your gem and ran across three words that trigger the error
pearson.rb:43:in block in define': undefined method
first' for nil:NilClass
using the code DictionaryLookup::Base.define(word)
The words I have run across have been "hash", "single", and "even"
I would be happy to look into the issue if you were open to me doing a pull request?
@nitishparkar I am interested in using dictionary_lookup. For example the word green
. There are 3 definitions. Using results.first.part_of_speech
and results.first.denotation
give us the first definition. Could you please tell me how we would obtain the second or third definitions.
The Dictionary API beta program has been suspended and the API is in a deprecated status. The API is still currently accessible to existing applications although public availability will be ending before the end of 2017. A notification will be sent to active developers once an exact shutdown schedule has been determined.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.