Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
jkho committed Jun 16, 2020
2 parents 6cf7d50 + d3b12f1 commit 77ed5df
Show file tree
Hide file tree
Showing 21 changed files with 58 additions and 108 deletions.
16 changes: 12 additions & 4 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2019-11-04 18:38:39 +0000 using RuboCop version 0.76.0.
# on 2019-11-07 23:26:30 +0000 using RuboCop version 0.76.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand Down Expand Up @@ -39,8 +39,16 @@ Metrics/ParameterLists:
Metrics/PerceivedComplexity:
Max: 8

# Offense count: 3
# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
Naming/FileName:
Exclude:
- 'examples/morphology_compound-components.rb'
- 'examples/morphology_han-readings.rb'
- 'examples/morphology_parts-of-speech.rb'

# Offense count: 10
# Rubocop not hip to RDoc directives.
Style/CommentedKeyword:
Exclude:
- 'lib/address_parameter.rb'
Expand Down Expand Up @@ -76,9 +84,9 @@ Style/IfUnlessModifier:
Style/RaiseArgs:
EnforcedStyle: compact

# Offense count: 15
# Offense count: 25
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Metrics/LineLength:
Max: 208
Max: 772
8 changes: 1 addition & 7 deletions examples/address_similarity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,7 @@
state: 'DC',
post_code: '20500'
)
address2 = AddressParameter.new(
house_number: '160',
road: 'Pennsilvana Avenue',
city: 'Washington',
state: 'D.C.',
post_code: '20500'
)
address2 = '160 Pennsilvana Avenue, Washington, D.C., 20500'
params = AddressSimilarityParameters.new(address1, address2)
response = rosette_api.get_address_similarity(params)
puts JSON.pretty_generate(response)
Expand Down
4 changes: 1 addition & 3 deletions examples/categories.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
RosetteAPI.new(api_key)
end

categories_url_data =
'https://onlocationvacations.com/2015/03/05/the-new-ghostbusters-movie-' \
'begins-filming-in-boston-in-june/'
categories_url_data = 'https://onlocationvacations.com/2018/02/06/downton-abbey-exhibition-extended-april-2-nyc/'
begin
params = DocumentParameters.new(content_uri: categories_url_data)
response = rosette_api.get_categories(params)
Expand Down
10 changes: 1 addition & 9 deletions examples/entities.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,7 @@
RosetteAPI.new(api_key)
end

entities_text_data = 'The Securities and Exchange Commission today ' \
'announced the leadership of the agency\'s trial unit. Bridget Fitzpatrick ' \
'has been named Chief Litigation Counsel of the SEC and David Gottesman ' \
'will continue to serve as the agency\'s Deputy Chief Litigation Counsel. ' \
'Since December 2016, Ms. Fitzpatrick and Mr. Gottesman have served as ' \
'Co-Acting Chief Litigation Counsel. In that role, they were jointly ' \
'responsible for supervising the trial unit at the agency\'s Washington ' \
'D.C. headquarters as well as coordinating with litigators in the SEC\'s ' \
'11 regional offices around the country.'
entities_text_data = 'The Securities and Exchange Commission today announced the leadership of the agency\'s trial unit. Bridget Fitzpatrick has been named Chief Litigation Counsel of the SEC and David Gottesman will continue to serve as the agency\'s Deputy Chief Litigation Counsel. Since December 2016, Ms. Fitzpatrick and Mr. Gottesman have served as Co-Acting Chief Litigation Counsel. In that role, they were jointly responsible for supervising the trial unit at the agency\'s Washington D.C. headquarters as well as coordinating with litigators in the SEC\'s 11 regional offices around the country.'
begin
params = DocumentParameters.new(content: entities_text_data,
genre: 'social-media')
Expand Down
10 changes: 1 addition & 9 deletions examples/language_multilingual.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,7 @@
RosetteAPI.new(api_key)
end

language_multilingual_data = 'On Thursday, as protesters gathered in ' \
'Washington D.C., the United States Federal Communications Commission ' \
'under Chairman Ajit Pai voted 3-2 to overturn a 2015 decision, commonly ' \
'called Net Neutrality, that forbade Internet service providers (ISPs) ' \
'such as Verizon, Comcast, and AT&T from blocking individual websites or ' \
'charging websites or customers more for faster load times. Quatre ' \
'femmes ont été nommées au Conseil de rédaction de la loi du Qatar. Jeudi, ' \
'le décret royal du Qatar a annoncé que 28 nouveaux membres ont été nommés ' \
'pour le Conseil de la Choura du pays. ذكرت مصادر أمنية يونانية، أن 9 موقوفين من منظمة \"د هـ ك ب ج\" الذين كانت قد أوقفتهم الشرطة اليونانية في وقت سابق كانوا يخططون لاغتيال الرئيس التركي رجب طيب أردوغان.'
language_multilingual_data = 'On Thursday, as protesters gathered in Washington D.C., the United States Federal Communications Commission under Chairman Ajit Pai voted 3-2 to overturn a 2015 decision, commonly called Net Neutrality, that forbade Internet service providers (ISPs) such as Verizon, Comcast, and AT&T from blocking individual websites or charging websites or customers more for faster load times. Quatre femmes ont été nommées au Conseil de rédaction de la loi du Qatar. Jeudi, le décret royal du Qatar a annoncé que 28 nouveaux membres ont été nommés pour le Conseil de la Choura du pays. ذكرت مصادر أمنية يونانية، أن 9 موقوفين من منظمة \"د هـ ك ب ج\" الذين كانت قد أوقفتهم الشرطة اليونانية في وقت سابق كانوا يخططون لاغتيال الرئيس التركي رجب طيب أردوغان.'

begin
params = DocumentParameters.new(content: language_multilingual_data)
Expand Down
3 changes: 1 addition & 2 deletions examples/morphology_complete.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
RosetteAPI.new(api_key)
end

morphology_complete_data = 'The quick brown fox jumped over the lazy ' \
'dog. 👍🏾 Yes he did. B)'
morphology_complete_data = 'The quick brown fox jumped over the lazy dog. 👍🏾 Yes he did. B)'
begin
params = DocumentParameters.new(content: morphology_complete_data)
response = rosette_api.get_morphology_complete(params)
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 1 addition & 3 deletions examples/morphology_lemmas.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
RosetteAPI.new(api_key)
end

morphology_lemmas_data =
'The fact is that the geese just went back to get a rest and I\'m not ' \
'banking on their return soon'
morphology_lemmas_data = 'The fact is that the geese just went back to get a rest and I\'m not banking on their return soon'
begin
params = DocumentParameters.new(content: morphology_lemmas_data)
response = rosette_api.get_lemmas(params)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
RosetteAPI.new(api_key)
end

morphology_parts_of_speech_data =
'The fact is that the geese just went back to get a rest and I\'m not ' \
'banking on their return soon'
morphology_parts_of_speech_data = 'The fact is that the geese just went back to get a rest and I\'m not banking on their return soon'
begin
params = DocumentParameters.new(content: morphology_parts_of_speech_data)
response = rosette_api.get_parts_of_speech(params)
Expand Down
4 changes: 1 addition & 3 deletions examples/name_deduplication.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
RosetteAPI.new(api_key)
end

name_dedupe_data = 'Alice Terry,Alice Thierry,Betty Grable,Betty Gable,' \
'Norma Shearer,Norm Shearer,Brigitte Helm,Bridget Helem,Judy Holliday,' \
'Julie Halliday'
name_dedupe_data = 'Alice Terry,Alice Thierry,Betty Grable,Betty Gable,Norma Shearer,Norm Shearer,Brigitte Helm,Bridget Helem,Judy Holliday,Julie Halliday'

threshold = 0.75
names = name_dedupe_data.split(',').map { |n| NameParameter.new(n) }
Expand Down
10 changes: 1 addition & 9 deletions examples/relationships.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,7 @@
RosetteAPI.new(api_key)
end

relationships_text_data = 'FLIR Systems is headquartered in Oregon and ' \
'produces thermal imaging, night vision, and infrared cameras and sensor ' \
'systems. According to the SEC\'s order instituting a settled ' \
'administrative proceeding, FLIR entered into a multi-million dollar ' \
'contract to provide thermal binoculars to the Saudi government in ' \
'November 2008. Timms and Ramahi were the primary sales employees ' \
'responsible for the contract, and also were involved in negotiations to ' \
'sell FLIR\'s security cameras to the same government officials. At the ' \
'time, Timms was the head of FLIR\'s Middle East office in Dubai.'
relationships_text_data = 'FLIR Systems is headquartered in Oregon and produces thermal imaging, night vision, and infrared cameras and sensor systems. According to the SEC\'s order instituting a settled administrative proceeding, FLIR entered into a multi-million dollar contract to provide thermal binoculars to the Saudi government in November 2008. Timms and Ramahi were the primary sales employees responsible for the contract, and also were involved in negotiations to sell FLIR\'s security cameras to the same government officials. At the time, Timms was the head of FLIR\'s Middle East office in Dubai.'

begin
params = DocumentParameters.new(content: relationships_text_data)
Expand Down
6 changes: 1 addition & 5 deletions examples/sentences.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@
RosetteAPI.new(api_key)
end

sentences_data = 'This land is your land. This land is my land, from ' \
'California to the New York island; from the red wood forest to the Gulf ' \
'Stream waters. This land was made for you and Me. As I was walking that ' \
'ribbon of highway, I saw above me that endless skyway: I saw below me ' \
'that golden valley: This land was made for you and me.'
sentences_data = 'This land is your land. This land is my land, from California to the New York island; from the red wood forest to the Gulf Stream waters. This land was made for you and Me. As I was walking that ribbon of highway, I saw above me that endless skyway: I saw below me that golden valley: This land was made for you and me.'

begin
params = DocumentParameters.new
Expand Down
8 changes: 1 addition & 7 deletions examples/sentiment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,7 @@
end

file = Tempfile.new(%w[foo .html])
sentiment_file_data =
'<html><head><title>New Ghostbusters Film</title></head><body><p>Original ' \
'Ghostbuster Dan Aykroyd, who also co-wrote the 1984 Ghostbusters film, ' \
'couldn\'t be more pleased with the new all-female Ghostbusters cast, ' \
'telling The Hollywood Reporter, "The Aykroyd family is delighted by this ' \
'inheritance of the Ghostbusters torch by these most magnificent women in ' \
'comedy."</p></body></html>'
sentiment_file_data = '<html><head><title>New Ghostbusters Film</title></head><body><p>Original Ghostbuster Dan Aykroyd, who also co-wrote the 1984 Ghostbusters film, couldn\'t be more pleased with the new all-female Ghostbusters cast, telling The Hollywood Reporter, "The Aykroyd family is delighted by this inheritance of the Ghostbusters torch by these most magnificent women in comedy."</p></body></html>'
file.write(sentiment_file_data)
file.close
begin
Expand Down
4 changes: 1 addition & 3 deletions examples/syntax_dependencies.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
RosetteAPI.new(api_key)
end

syntax_dependencies_data =
'Yoshinori Ohsumi, a Japanese cell biologist, was awarded the Nobel Prize ' \
'in Physiology or Medicine on Monday.'
syntax_dependencies_data = 'Yoshinori Ohsumi, a Japanese cell biologist, was awarded the Nobel Prize in Physiology or Medicine on Monday.'

begin
params = DocumentParameters.new(content: syntax_dependencies_data)
Expand Down
10 changes: 2 additions & 8 deletions examples/topics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,8 @@
RosetteAPI.new(api_key)
end

topics_data =
'Lily Collins is in talks to join Nicholas Hoult in Chernin Entertainment ' \
"and Fox Searchlight's J.R.R. Tolkien biopic Tolkien. Anthony Boyle, known " \
'for playing Scorpius Malfoy in the British play Harry Potter and the ' \
'Cursed Child, also has signed on for the film centered on the famed ' \
'author. In Tolkien, Hoult will play the author of the Hobbit and Lord of ' \
'the Rings book series that were later adapted into two Hollywood ' \
'trilogies from Peter Jackson. Dome Karukoski is directing the project.'
topics_data = 'Lily Collins is in talks to join Nicholas Hoult in Chernin Entertainment and Fox Searchlight\'s J.R.R. Tolkien biopic Tolkien. Anthony Boyle, known for playing Scorpius Malfoy in the British play Harry Potter and the Cursed Child, also has signed on for the film centered on the famed author. In Tolkien, Hoult will play the author of the Hobbit and Lord of the Rings book series that were later adapted into two Hollywood trilogies from Peter Jackson. Dome Karukoski is directing the project.'

begin
params = DocumentParameters.new(content: topics_data)
response = rosette_api.get_topics(params)
Expand Down
3 changes: 1 addition & 2 deletions examples/transliteration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
RosetteAPI.new(api_key)
end

transliteration_content_data =
'Kareem Abdul Jabbar holds the records for most points in the NBA'
transliteration_content_data = 'ana r2ye7 el gam3a el sa3a 3 el 3asr'

begin
params = DocumentParameters.new
Expand Down
10 changes: 5 additions & 5 deletions lib/address_similarity_parameters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ def initialize(address1, address2) #:notnew:
end

# Validates the parameters by checking if address1 and address2 are instances
# of AddressParameter.
# of AddressParameters or Strings.
def validate_params
a1_msg = 'address1 option can only be an instance of an AddressParameter'
raise BadRequestError.new(a1_msg) if [AddressParameter].none? { |clazz| @address1.is_a? clazz }
a1_msg = 'address1 option can only be an instance of an AddressParameter or a String'
raise BadRequestError.new(a1_msg) if [String, AddressParameter].none? { |clazz| @address1.is_a? clazz }

a2_msg = 'address2 option can only be an instance of an AddressParameter'
raise BadRequestError.new(a2_msg) if [AddressParameter].none? { |clazz| @address2.is_a? clazz }
a2_msg = 'address2 option can only be an instance of an AddressParameter or a String'
raise BadRequestError.new(a2_msg) if [String, AddressParameter].none? { |clazz| @address2.is_a? clazz }
end

# Converts this class to Hash with its keys in lower CamelCase.
Expand Down
2 changes: 1 addition & 1 deletion lib/rosette_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# This class allows you to access all Rosette API endpoints.
class RosetteAPI
# Version of Ruby binding
BINDING_VERSION = '1.14.3'
BINDING_VERSION = '1.14.4'
# Rosette API language endpoint
LANGUAGE_ENDPOINT = '/language'
# Rosette API morphology endpoint
Expand Down
4 changes: 2 additions & 2 deletions rosette_api.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Gem::Specification.new do |s|
s.required_ruby_version = '>= 2.3.0'

s.name = 'rosette_api'
s.version = '1.14.3'
s.version = '1.14.4'
s.license = 'Apache-2.0'

s.summary = 'A Ruby interface for Rosette Text Analytics Platform.'
Expand All @@ -23,7 +23,7 @@ Gem::Specification.new do |s|
s.authors = ['Basis Technology Corp']
s.email = '[email protected]'
s.homepage = 'https://developer.rosette.com/'
s.date = '2019-11-06'
s.date = '2020-06-16'

s.files = Dir['LICENSE', 'README.md', 'lib/**/*', 'examples/**/*']
s.require_paths = ['lib']
Expand Down
Loading

0 comments on commit 77ed5df

Please sign in to comment.