From b745e9a2e28f19624b3e41348a0d0c35f773d9bc Mon Sep 17 00:00:00 2001 From: Christopher Park Date: Tue, 29 Nov 2016 13:14:18 -0500 Subject: [PATCH 1/5] Removed entities/linked (#44) - Removed entities_linked.rb example - Removed deprecated call in rosette_api.rb - unit tests pass --- examples/README.md | 1 - examples/entities_linked.rb | 14 -------------- lib/rosette_api.rb | 23 ++--------------------- 3 files changed, 2 insertions(+), 36 deletions(-) delete mode 100644 examples/entities_linked.rb diff --git a/examples/README.md b/examples/README.md index 0b8d603..571a7e4 100644 --- a/examples/README.md +++ b/examples/README.md @@ -22,7 +22,6 @@ Each example, when run, prints its output to the console. | ------------- |------------- | | categories.rb | Gets the category of a document at a URL | | entities.rb | Gets the entities from a piece of text | -| entities_linked.rb | Gets the linked (to Wikipedia) entities from a piece of text | | info.rb | Gets information about Rosette API | | language.rb | Gets the language of a piece of text | | name_similarity.rb | Gets the similarity score of two names | diff --git a/examples/entities_linked.rb b/examples/entities_linked.rb deleted file mode 100644 index c432498..0000000 --- a/examples/entities_linked.rb +++ /dev/null @@ -1,14 +0,0 @@ -require 'rosette_api' - -api_key, url = ARGV - -if !url - rosette_api = RosetteAPI.new(api_key) -else - rosette_api = RosetteAPI.new(api_key, url) -end - -entities_linked_text_data = "Last month director Paul Feig announced the movie will have an all-star female cast including Kristen Wiig, Melissa McCarthy, Leslie Jones and Kate McKinnon." -params = DocumentParameters.new(content: entities_linked_text_data, genre: 'social-media') -response = rosette_api.get_entities(params, true) -puts JSON.pretty_generate(response) diff --git a/lib/rosette_api.rb b/lib/rosette_api.rb index 6399e50..a309240 100644 --- a/lib/rosette_api.rb +++ b/lib/rosette_api.rb @@ -165,37 +165,18 @@ def get_parts_of_speech(params) # ==== Attributes # # * +params+ - DocumentParameters helps to build the request body in RequestBuilder. - # * +resolve_entities+ - Enables entities to be linked in application endpoints. # # Returns each entity extracted from the input. - def get_entities(params, resolve_entities = false) + def get_entities(params) check_params params - raise BadRequestError.new('Expects boolean for resolve_entities') unless !!resolve_entities == resolve_entities - params = params.load_params - endpoint = resolve_entities ? (ENTITIES_ENDPOINT + '/linked') : ENTITIES_ENDPOINT + endpoint = ENTITIES_ENDPOINT RequestBuilder.new(@user_key, @alternate_url + endpoint, @http_client, params, BINDING_VERSION) .send_post_request end - # Extracts entities from the input. - # - # ==== Attributes - # - # * +params+ - DocumentParameters helps to build the request body in RequestBuilder. - # - # Returns list of entities that have been linked to entities in the knowledge - # base. - def get_entities_linked(params) - warn '[DEPRECATION] `get_entities_linked` is deprecated. Please use ' \ - '`get_entities` instead.' - get_entities(params, true) - end - - - # Extracts Tier 1 contextual categories from the input. # # ==== Attributes From 334bae6f3e2825777124add10cdadd6e30da0fbf Mon Sep 17 00:00:00 2001 From: Chris Park Date: Tue, 6 Dec 2016 09:11:27 -0500 Subject: [PATCH 2/5] Initial begin/rescue for Ruby --- examples/categories.rb | 10 +++++++--- examples/entities.rb | 10 +++++++--- examples/entities_linked.rb | 10 +++++++--- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/examples/categories.rb b/examples/categories.rb index 9991823..8ec4971 100644 --- a/examples/categories.rb +++ b/examples/categories.rb @@ -9,6 +9,10 @@ end categories_url_data = "http://www.onlocationvacations.com/2015/03/05/the-new-ghostbusters-movie-begins-filming-in-boston-in-june/" -params = DocumentParameters.new(content_uri: categories_url_data) -response = rosette_api.get_categories(params) -puts JSON.pretty_generate(response) +begin + params = DocumentParameters.new(content_uri: categories_url_data) + response = rosette_api.get_categories(params) + puts JSON.pretty_generate(response) +rescue RosetteAPIError => rosette_api_error + printf("Rosette API Error (%s): %s", rosette_api_error.status_code, rosette_api_error.message) +end diff --git a/examples/entities.rb b/examples/entities.rb index f4fb8d4..ffd91f0 100644 --- a/examples/entities.rb +++ b/examples/entities.rb @@ -9,6 +9,10 @@ end entities_text_data = "Bill Murray will appear in new Ghostbusters film: Dr. Peter Venkman was spotted filming a cameo in Boston this… http://dlvr.it/BnsFfS" -params = DocumentParameters.new(content: entities_text_data, genre: 'social-media') -response = rosette_api.get_entities(params) -puts JSON.pretty_generate(response) +begin + params = DocumentParameters.new(content: entities_text_data, genre: 'social-media') + response = rosette_api.get_entities(params) + puts JSON.pretty_generate(response) +rescue RosetteAPIError => rosette_api_error + printf("Rosette API Error (%s): %s", rosette_api_error.status_code, rosette_api_error.message) +end diff --git a/examples/entities_linked.rb b/examples/entities_linked.rb index c432498..0486924 100644 --- a/examples/entities_linked.rb +++ b/examples/entities_linked.rb @@ -9,6 +9,10 @@ end entities_linked_text_data = "Last month director Paul Feig announced the movie will have an all-star female cast including Kristen Wiig, Melissa McCarthy, Leslie Jones and Kate McKinnon." -params = DocumentParameters.new(content: entities_linked_text_data, genre: 'social-media') -response = rosette_api.get_entities(params, true) -puts JSON.pretty_generate(response) +begin + params = DocumentParameters.new(content: entities_linked_text_data, genre: 'social-media') + response = rosette_api.get_entities(params, true) + puts JSON.pretty_generate(response) +rescue RosetteAPIError => rosette_api_error + printf("Rosette API Error (%s): %s", rosette_api_error.status_code, rosette_api_error.message) +end From 9247ff711ce1889131cfdd078344451c5f866b82 Mon Sep 17 00:00:00 2001 From: Chris Park Date: Tue, 6 Dec 2016 12:50:03 -0500 Subject: [PATCH 3/5] Forgot to commit the rest of the changes --- examples/info.rb | 6 +++++- examples/language.rb | 12 ++++++++---- examples/morphology_complete.rb | 10 +++++++--- examples/morphology_compound-components.rb | 10 +++++++--- examples/morphology_han-readings.rb | 10 +++++++--- examples/morphology_lemmas.rb | 10 +++++++--- examples/morphology_parts-of-speech.rb | 10 +++++++--- examples/name_similarity.rb | 12 ++++++++---- examples/name_translation.rb | 10 +++++++--- examples/ping.rb | 8 ++++++-- examples/relationships.rb | 12 ++++++++---- examples/sentences.rb | 12 ++++++++---- examples/sentiment.rb | 10 +++++++--- examples/syntax_dependencies.rb | 10 +++++++--- examples/text_embedding.rb | 10 +++++++--- examples/tokens.rb | 10 +++++++--- 16 files changed, 113 insertions(+), 49 deletions(-) diff --git a/examples/info.rb b/examples/info.rb index a82e022..308792a 100644 --- a/examples/info.rb +++ b/examples/info.rb @@ -8,4 +8,8 @@ rosette_api = RosetteAPI.new(api_key, url) end response = rosette_api.info -puts JSON.pretty_generate(response) \ No newline at end of file +begin + puts JSON.pretty_generate(response) +rescue RosetteAPIError => rosette_api_error + printf("Rosette API Error (%s): %s", rosette_api_error.status_code, rosette_api_error.message) +end diff --git a/examples/language.rb b/examples/language.rb index c26e07b..4611b0d 100644 --- a/examples/language.rb +++ b/examples/language.rb @@ -9,7 +9,11 @@ end language_data = "Por favor Señorita, says the man." -params = DocumentParameters.new(content: language_data) -params.custom_headers = { 'X-RosetteAPI-App'=> 'ruby-app'} -response = rosette_api.get_language(params) -puts JSON.pretty_generate(response) \ No newline at end of file +begin + params = DocumentParameters.new(content: language_data) + params.custom_headers = { 'X-RosetteAPI-App'=> 'ruby-app'} + response = rosette_api.get_language(params) + puts JSON.pretty_generate(response) +rescue RosetteAPIError => rosette_api_error + printf("Rosette API Error (%s): %s", rosette_api_error.status_code, rosette_api_error.message) +end diff --git a/examples/morphology_complete.rb b/examples/morphology_complete.rb index 3bdc348..0603749 100644 --- a/examples/morphology_complete.rb +++ b/examples/morphology_complete.rb @@ -9,6 +9,10 @@ end morphology_complete_data = "The quick brown fox jumped over the lazy dog. Yes he did." -params = DocumentParameters.new(content: morphology_complete_data) -response = rosette_api.get_morphology_complete(params) -puts JSON.pretty_generate(response) +begin + params = DocumentParameters.new(content: morphology_complete_data) + response = rosette_api.get_morphology_complete(params) + puts JSON.pretty_generate(response) +rescue RosetteAPIError => rosette_api_error + printf("Rosette API Error (%s): %s", rosette_api_error.status_code, rosette_api_error.message) +end diff --git a/examples/morphology_compound-components.rb b/examples/morphology_compound-components.rb index 686dd9e..8d64fef 100644 --- a/examples/morphology_compound-components.rb +++ b/examples/morphology_compound-components.rb @@ -9,6 +9,10 @@ end morphology_compound_components_data = "Rechtsschutzversicherungsgesellschaften" -params = DocumentParameters.new(content: morphology_compound_components_data) -response = rosette_api.get_compound_components(params) -puts JSON.pretty_generate(response) \ No newline at end of file +begin + params = DocumentParameters.new(content: morphology_compound_components_data) + response = rosette_api.get_compound_components(params) + puts JSON.pretty_generate(response) +rescue RosetteAPIError => rosette_api_error + printf("Rosette API Error (%s): %s", rosette_api_error.status_code, rosette_api_error.message) +end diff --git a/examples/morphology_han-readings.rb b/examples/morphology_han-readings.rb index 00b0dea..f5dd582 100644 --- a/examples/morphology_han-readings.rb +++ b/examples/morphology_han-readings.rb @@ -9,6 +9,10 @@ end morphology_han_readings_data = "北京大学生物系主任办公室内部会议" -params = DocumentParameters.new(content: morphology_han_readings_data) -response = rosette_api.get_han_readings(params) -puts JSON.pretty_generate(response) \ No newline at end of file +begin + params = DocumentParameters.new(content: morphology_han_readings_data) + response = rosette_api.get_han_readings(params) + puts JSON.pretty_generate(response) +rescue RosetteAPIError => rosette_api_error + printf("Rosette API Error (%s): %s", rosette_api_error.status_code, rosette_api_error.message) +end diff --git a/examples/morphology_lemmas.rb b/examples/morphology_lemmas.rb index ce72907..a8fff0d 100644 --- a/examples/morphology_lemmas.rb +++ b/examples/morphology_lemmas.rb @@ -9,6 +9,10 @@ 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" -params = DocumentParameters.new(content: morphology_lemmas_data) -response = rosette_api.get_lemmas(params) -puts JSON.pretty_generate(response) \ No newline at end of file +begin + params = DocumentParameters.new(content: morphology_lemmas_data) + response = rosette_api.get_lemmas(params) + puts JSON.pretty_generate(response) +rescue RosetteAPIError => rosette_api_error + printf("Rosette API Error (%s): %s", rosette_api_error.status_code, rosette_api_error.message) +end diff --git a/examples/morphology_parts-of-speech.rb b/examples/morphology_parts-of-speech.rb index ea65436..8deea6f 100644 --- a/examples/morphology_parts-of-speech.rb +++ b/examples/morphology_parts-of-speech.rb @@ -9,6 +9,10 @@ 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" -params = DocumentParameters.new(content: morphology_parts_of_speech_data) -response = rosette_api.get_parts_of_speech(params) -puts JSON.pretty_generate(response) \ No newline at end of file +begin + params = DocumentParameters.new(content: morphology_parts_of_speech_data) + response = rosette_api.get_parts_of_speech(params) + puts JSON.pretty_generate(response) +rescue RosetteAPIError => rosette_api_error + printf("Rosette API Error (%s): %s", rosette_api_error.status_code, rosette_api_error.message) +end diff --git a/examples/name_similarity.rb b/examples/name_similarity.rb index de3b427..f776a49 100644 --- a/examples/name_similarity.rb +++ b/examples/name_similarity.rb @@ -10,7 +10,11 @@ matched_name_data1 = "Michael Jackson" matched_name_data2 = "迈克尔·杰克逊" -name1 = NameParameter.new(matched_name_data1, entity_type: 'PERSON', language:'eng') -params = NameSimilarityParameters.new(name1, matched_name_data2) -response = rosette_api.name_similarity(params) -puts JSON.pretty_generate(response) \ No newline at end of file +begin + name1 = NameParameter.new(matched_name_data1, entity_type: 'PERSON', language:'eng') + params = NameSimilarityParameters.new(name1, matched_name_data2) + response = rosette_api.name_similarity(params) + puts JSON.pretty_generate(response) +rescue RosetteAPIError => rosette_api_error + printf("Rosette API Error (%s): %s", rosette_api_error.status_code, rosette_api_error.message) +end diff --git a/examples/name_translation.rb b/examples/name_translation.rb index 3b6def4..b48ba1d 100644 --- a/examples/name_translation.rb +++ b/examples/name_translation.rb @@ -9,6 +9,10 @@ end translated_name_data = "معمر محمد أبو منيار القذاف" -params = NameTranslationParameters.new(translated_name_data, 'eng', target_script: 'Latn') -response = rosette_api.name_translation(params) -puts JSON.pretty_generate(response) \ No newline at end of file +begin + params = NameTranslationParameters.new(translated_name_data, 'eng', target_script: 'Latn') + response = rosette_api.name_translation(params) + puts JSON.pretty_generate(response) +rescue RosetteAPIError => rosette_api_error + printf("Rosette API Error (%s): %s", rosette_api_error.status_code, rosette_api_error.message) +end diff --git a/examples/ping.rb b/examples/ping.rb index fc43e18..b96bcdc 100644 --- a/examples/ping.rb +++ b/examples/ping.rb @@ -7,5 +7,9 @@ else rosette_api = RosetteAPI.new(api_key, url) end -response = rosette_api.ping -puts JSON.pretty_generate(response) \ No newline at end of file +begin + response = rosette_api.ping + puts JSON.pretty_generate(response) +rescue RosetteAPIError => rosette_api_error + printf("Rosette API Error (%s): %s", rosette_api_error.status_code, rosette_api_error.message) +end diff --git a/examples/relationships.rb b/examples/relationships.rb index 043bf7d..913a81d 100644 --- a/examples/relationships.rb +++ b/examples/relationships.rb @@ -9,7 +9,11 @@ end relationships_text_data = "Bill Gates, Microsoft's former CEO, is a philanthropist." -params = DocumentParameters.new(content: relationships_text_data) -params.rosette_options = { accuracyMode: 'PRECISION' } -response = rosette_api.get_relationships(params) -puts JSON.pretty_generate(response) +begin + params = DocumentParameters.new(content: relationships_text_data) + params.rosette_options = { accuracyMode: 'PRECISION' } + response = rosette_api.get_relationships(params) + puts JSON.pretty_generate(response) +rescue RosetteAPIError => rosette_api_error + printf("Rosette API Error (%s): %s", rosette_api_error.status_code, rosette_api_error.message) +end diff --git a/examples/sentences.rb b/examples/sentences.rb index 2751f27..678c0d0 100644 --- a/examples/sentences.rb +++ b/examples/sentences.rb @@ -12,7 +12,11 @@ ' wood forest to the Gulf Stream waters\n\nThis land was made for you and Me.\n\nAs I was walking' \ ' that ribbon of highway,\nI saw above me that endless skyway:\nI saw below me that' \ ' golden valley:\nThis land was made for you and me.' -params = DocumentParameters.new -params.content = sentences_data -response = rosette_api.get_sentences(params) -puts JSON.pretty_generate(response) \ No newline at end of file +begin + params = DocumentParameters.new + params.content = sentences_data + response = rosette_api.get_sentences(params) + puts JSON.pretty_generate(response) +rescue RosetteAPIError => rosette_api_error + printf("Rosette API Error (%s): %s", rosette_api_error.status_code, rosette_api_error.message) +end diff --git a/examples/sentiment.rb b/examples/sentiment.rb index bc4a31f..2c55e45 100644 --- a/examples/sentiment.rb +++ b/examples/sentiment.rb @@ -18,6 +18,10 @@ '.

' file.write(sentiment_file_data) file.close -params = DocumentParameters.new(file_path: file.path, language: 'eng') -response = rosette_api.get_sentiment(params) -puts JSON.pretty_generate(response) \ No newline at end of file +begin + params = DocumentParameters.new(file_path: file.path, language: 'eng') + response = rosette_api.get_sentiment(params) + puts JSON.pretty_generate(response) +rescue RosetteAPIError => rosette_api_error + printf("Rosette API Error (%s): %s", rosette_api_error.status_code, rosette_api_error.message) +end diff --git a/examples/syntax_dependencies.rb b/examples/syntax_dependencies.rb index 2fe8fd7..95c36c9 100644 --- a/examples/syntax_dependencies.rb +++ b/examples/syntax_dependencies.rb @@ -9,6 +9,10 @@ end syntax_dependencies_data = "Yoshinori Ohsumi, a Japanese cell biologist, was awarded the Nobel Prize in Physiology or Medicine on Monday." -params = DocumentParameters.new(content: syntax_dependencies_data, genre: 'social-media') -response = rosette_api.get_syntax_dependencies(params) -puts JSON.pretty_generate(response) +begin + params = DocumentParameters.new(content: syntax_dependencies_data, genre: 'social-media') + response = rosette_api.get_syntax_dependencies(params) + puts JSON.pretty_generate(response) +rescue RosetteAPIError => rosette_api_error + printf("Rosette API Error (%s): %s", rosette_api_error.status_code, rosette_api_error.message) +end diff --git a/examples/text_embedding.rb b/examples/text_embedding.rb index 29cb5a3..882760a 100644 --- a/examples/text_embedding.rb +++ b/examples/text_embedding.rb @@ -9,6 +9,10 @@ end embeddings_data = 'Cambridge, Massachusetts' -params = DocumentParameters.new(content: embeddings_data) -response = rosette_api.get_text_embedding(params) -puts JSON.pretty_generate(response) +begin + params = DocumentParameters.new(content: embeddings_data) + response = rosette_api.get_text_embedding(params) + puts JSON.pretty_generate(response) +rescue RosetteAPIError => rosette_api_error + printf("Rosette API Error (%s): %s", rosette_api_error.status_code, rosette_api_error.message) +end diff --git a/examples/tokens.rb b/examples/tokens.rb index b77c495..cebf3fc 100644 --- a/examples/tokens.rb +++ b/examples/tokens.rb @@ -9,6 +9,10 @@ end tokens_data = "北京大学生物系主任办公室内部会议" -params = DocumentParameters.new(content: tokens_data) -response = rosette_api.get_tokens(params) -puts JSON.pretty_generate(response) \ No newline at end of file +begin + params = DocumentParameters.new(content: tokens_data) + response = rosette_api.get_tokens(params) + puts JSON.pretty_generate(response) +rescue RosetteAPIError => rosette_api_error + printf("Rosette API Error (%s): %s", rosette_api_error.status_code, rosette_api_error.message) +end From 4736d0e9a5d02e7907b0fadedd67be2833bc9ff2 Mon Sep 17 00:00:00 2001 From: Chris Park Date: Wed, 7 Dec 2016 11:43:56 -0500 Subject: [PATCH 4/5] urlParameters added to API Performed initial code cleanup per rubocop and reek --- .rubocop.yml | 312 +++++++++++++++++++++++++++++++++++++ examples/entities.rb | 3 +- examples/sentences.rb | 6 +- examples/sentiment.rb | 9 +- lib/document_parameters.rb | 8 +- lib/request_builder.rb | 17 +- lib/rosette_api.rb | 81 +++++----- 7 files changed, 374 insertions(+), 62 deletions(-) create mode 100644 .rubocop.yml diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..44c5710 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,312 @@ +# This configuration was generated by +# `rubocop --auto-gen-config` +# on 2016-12-07 10:52:04 -0500 using RuboCop version 0.46.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 +# versions of RuboCop, may require this file to be generated again. + +# Offense count: 1 +# Configuration parameters: Include. +# Include: **/Gemfile, **/gems.rb +Bundler/OrderedGems: + Exclude: + - 'Gemfile' + +# Offense count: 2 +Lint/Void: + Exclude: + - 'examples/sentences.rb' + - 'examples/sentiment.rb' + +# Offense count: 3 +Metrics/AbcSize: + Max: 41 + +# Offense count: 4 +# Configuration parameters: CountComments. +Metrics/BlockLength: + Max: 425 + +# Offense count: 2 +# Configuration parameters: CountComments. +Metrics/ClassLength: + Max: 140 + +# Offense count: 142 +# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. +# URISchemes: http, https +Metrics/LineLength: + Max: 408 + +# Offense count: 6 +# Configuration parameters: CountComments. +Metrics/MethodLength: + Max: 42 + +# Offense count: 1 +# Configuration parameters: CountKeywordArgs. +Metrics/ParameterLists: + Max: 6 + +# Offense count: 94 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle, SupportedLastArgumentHashStyles. +# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit +Style/AlignHash: + Exclude: + - 'tests/tests_spec.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, FunctionalMethods, IgnoredMethods. +# SupportedStyles: line_count_based, semantic, braces_for_chaining +# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object +# FunctionalMethods: let, let!, subject, watch +# IgnoredMethods: lambda, proc, it +Style/BlockDelimiters: + Exclude: + - 'tests/tests_spec.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/BlockEndNewline: + Exclude: + - 'tests/tests_spec.rb' + +# Offense count: 18 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SupportedStyles, SingleLineConditionsOnly. +# SupportedStyles: assign_to_condition, assign_inside_condition +Style/ConditionalAssignment: + Enabled: false + +# Offense count: 40 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SupportedStyles. +# SupportedStyles: leading, trailing +Style/DotPosition: + Exclude: + - 'tests/tests_spec.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: AllowAdjacentOneLineDefs. +Style/EmptyLineBetweenDefs: + Exclude: + - 'lib/rosette_api.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +Style/EmptyLines: + Exclude: + - 'examples/sentiment.rb' + - 'lib/request_builder.rb' + - 'rosette_api.gemspec' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SupportedStyles. +# SupportedStyles: empty_lines, no_empty_lines +Style/EmptyLinesAroundBlockBody: + Exclude: + - 'tests/tests_spec.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/EmptyLinesAroundMethodBody: + Exclude: + - 'lib/request_builder.rb' + +# Offense count: 3 +# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts. +Style/FileName: + Exclude: + - 'examples/morphology_compound-components.rb' + - 'examples/morphology_han-readings.rb' + - 'examples/morphology_parts-of-speech.rb' + +# Offense count: 2 +# Configuration parameters: SupportedStyles. +# SupportedStyles: for, each +Style/For: + EnforcedStyle: for + +# Offense count: 30 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SupportedStyles. +# SupportedStyles: when_needed, always +Style/FrozenStringLiteralComment: + Enabled: false + +# Offense count: 4 +# Configuration parameters: MinBodyLength. +Style/GuardClause: + Exclude: + - 'lib/name_similarity_parameters.rb' + - 'lib/name_translation_parameters.rb' + - 'lib/request_builder.rb' + +# Offense count: 90 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols. +# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys +Style/HashSyntax: + Exclude: + - 'tests/tests_spec.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SupportedStyles. +# SupportedStyles: normal, rails +Style/IndentationConsistency: + Exclude: + - 'examples/sentences.rb' + - 'examples/sentiment.rb' + - 'lib/rosette_api.rb' + +# Offense count: 5 +# Cop supports --auto-correct. +# Configuration parameters: Width. +Style/IndentationWidth: + Exclude: + - 'examples/morphology_han-readings.rb' + - 'lib/request_builder.rb' + - 'tests/tests_spec.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/MultilineBlockLayout: + Exclude: + - 'tests/tests_spec.rb' + +# Offense count: 41 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth. +# SupportedStyles: aligned, indented, indented_relative_to_receiver +Style/MultilineMethodCallIndentation: + Exclude: + - 'tests/tests_spec.rb' + +# Offense count: 15 +# Cop supports --auto-correct. +Style/MutableConstant: + Exclude: + - 'lib/rosette_api.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/NegatedIf: + Exclude: + - 'lib/name_translation_parameters.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: IncludeSemanticChanges. +Style/NonNilCheck: + Exclude: + - 'lib/request_builder.rb' + +# Offense count: 2 +Style/OptionalArguments: + Exclude: + - 'lib/request_builder.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +# Configuration parameters: PreferredDelimiters. +Style/PercentLiteralDelimiters: + Exclude: + - 'rosette_api.gemspec' + +# Offense count: 8 +# Cop supports --auto-correct. +# Configuration parameters: SupportedStyles. +# SupportedStyles: compact, exploded +Style/RaiseArgs: + EnforcedStyle: compact + +# Offense count: 7 +# Cop supports --auto-correct. +Style/RedundantSelf: + Exclude: + - 'lib/document_parameters.rb' + - 'lib/name_parameter.rb' + - 'lib/name_similarity_parameters.rb' + - 'lib/name_translation_parameters.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/SpaceAfterColon: + Exclude: + - 'examples/name_similarity.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: AllowForAlignment. +Style/SpaceAroundOperators: + Exclude: + - 'examples/language.rb' + - 'rosette_api.gemspec' + +# Offense count: 56 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles. +# SupportedStyles: space, no_space, compact +Style/SpaceInsideHashLiteralBraces: + Exclude: + - 'examples/language.rb' + - 'tests/tests_spec.rb' + +# Offense count: 44 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SupportedStyles, ConsistentQuotesInMultiline. +# SupportedStyles: single_quotes, double_quotes +Style/StringLiterals: + Exclude: + - 'Gemfile' + - 'examples/categories.rb' + - 'examples/entities.rb' + - 'examples/language.rb' + - 'examples/morphology_complete.rb' + - 'examples/morphology_compound-components.rb' + - 'examples/morphology_han-readings.rb' + - 'examples/name_similarity.rb' + - 'examples/name_translation.rb' + - 'examples/sentiment.rb' + - 'examples/syntax_dependencies.rb' + - 'examples/tokens.rb' + - 'tests/tests_spec.rb' + +# Offense count: 14 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SupportedStyles. +# SupportedStyles: final_newline, final_blank_line +Style/TrailingBlankLines: + Exclude: + - 'examples/info.rb' + - 'examples/language.rb' + - 'examples/morphology_compound-components.rb' + - 'examples/morphology_han-readings.rb' + - 'examples/morphology_lemmas.rb' + - 'examples/morphology_parts-of-speech.rb' + - 'examples/name_similarity.rb' + - 'examples/name_translation.rb' + - 'examples/ping.rb' + - 'examples/sentences.rb' + - 'examples/sentiment.rb' + - 'examples/tokens.rb' + - 'lib/rosette_api.rb' + - 'lib/rosette_api_error.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/TrailingWhitespace: + Exclude: + - 'lib/request_builder.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +Style/UnneededPercentQ: + Exclude: + - 'rosette_api.gemspec' diff --git a/examples/entities.rb b/examples/entities.rb index f4fb8d4..ded3386 100644 --- a/examples/entities.rb +++ b/examples/entities.rb @@ -1,3 +1,4 @@ +# encoding: UTF-8 require 'rosette_api' api_key, url = ARGV @@ -8,7 +9,7 @@ rosette_api = RosetteAPI.new(api_key, url) end -entities_text_data = "Bill Murray will appear in new Ghostbusters film: Dr. Peter Venkman was spotted filming a cameo in Boston this… http://dlvr.it/BnsFfS" +entities_text_data = 'Bill Murray will appear in new Ghostbusters film: Dr. Peter Venkman was spotted filming a cameo in Boston this… http://dlvr.it/BnsFfS' params = DocumentParameters.new(content: entities_text_data, genre: 'social-media') response = rosette_api.get_entities(params) puts JSON.pretty_generate(response) diff --git a/examples/sentences.rb b/examples/sentences.rb index 2751f27..05c3b21 100644 --- a/examples/sentences.rb +++ b/examples/sentences.rb @@ -9,10 +9,8 @@ end sentences_data = "This land is your land. This land is my land\nFrom California to the New York island;\nFrom the red wood forest to the Gulf Stream waters\n\nThis land was made for you and Me.\n\nAs I was walking that ribbon of highway,\nI saw above me that endless skyway:\nI saw below me that golden valley:\nThis land was made for you and me." - ' wood forest to the Gulf Stream waters\n\nThis land was made for you and Me.\n\nAs I was walking' \ - ' that ribbon of highway,\nI saw above me that endless skyway:\nI saw below me that' \ - ' golden valley:\nThis land was made for you and me.' + params = DocumentParameters.new params.content = sentences_data response = rosette_api.get_sentences(params) -puts JSON.pretty_generate(response) \ No newline at end of file +puts JSON.pretty_generate(response) diff --git a/examples/sentiment.rb b/examples/sentiment.rb index bc4a31f..cf21789 100644 --- a/examples/sentiment.rb +++ b/examples/sentiment.rb @@ -9,15 +9,10 @@ rosette_api = RosetteAPI.new(api_key, url) end - file = Tempfile.new(%w(foo .html)) -sentiment_file_data = "New Ghostbusters Film

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.”

" - '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 ' \ - '.

' +sentiment_file_data = 'New Ghostbusters Film

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.”

' file.write(sentiment_file_data) file.close params = DocumentParameters.new(file_path: file.path, language: 'eng') response = rosette_api.get_sentiment(params) -puts JSON.pretty_generate(response) \ No newline at end of file +puts JSON.pretty_generate(response) diff --git a/lib/document_parameters.rb b/lib/document_parameters.rb index 43cc36e..71fa99a 100644 --- a/lib/document_parameters.rb +++ b/lib/document_parameters.rb @@ -56,10 +56,10 @@ def validate_params # # Returns the new Hash. def load_params - self.validate_params - self.to_hash.select { |_key, value| !value.nil? } - .map { |key, value| [key.to_s.split('_').map(&:capitalize).join.sub!(/\D/, &:downcase), value] } - .to_h + validate_params + to_hash.select { |_key, value| !value.nil? } + .map { |key, value| [key.to_s.split('_').map(&:capitalize).join.sub!(/\D/, &:downcase), value] } + .to_h end # Converts this class to Hash. diff --git a/lib/request_builder.rb b/lib/request_builder.rb index d417beb..1735440 100644 --- a/lib/request_builder.rb +++ b/lib/request_builder.rb @@ -19,13 +19,16 @@ class RequestBuilder attr_accessor :binding_version - def initialize(user_key, alternate_url, http_client, params = {}, binding_version) #:notnew: + def initialize(user_key, alternate_url, http_client, params = {}, url_parameters = nil, binding_version) @user_key = user_key @alternate_url = alternate_url @http_client = http_client @params = params @binding_version = binding_version + return unless url_parameters + @alternate_url = @alternate_url + '?' + URI.encode_www_form(url_parameters) + end # Prepares a plain POST request for Rosette API. @@ -43,7 +46,7 @@ def prepare_plain_request(params) raise RosetteAPIError.new 'connectionError', 'Failed to establish connection with Rosette API server.' end - if params['customHeaders'] != nil + if params['customHeaders'] keys_array = params['customHeaders'].keys for k in keys_array if k.to_s =~ /^X-RosetteAPI-/ @@ -141,20 +144,20 @@ def send_get_request end request['X-RosetteAPI-Key'] = @user_key - self.get_response @http_client, request + get_response @http_client, request end # Sends a POST request to Rosette API. # # Returns JSON response or raises RosetteAPIError if encountered. def send_post_request - if !params['filePath'].nil? - http, request = self.prepare_multipart_request params + if params['filePath'] + http, request = prepare_multipart_request params else - http, request = self.prepare_plain_request params + http, request = prepare_plain_request params end - self.get_response http, request + get_response http, request end # Gets response from HTTP connection. diff --git a/lib/rosette_api.rb b/lib/rosette_api.rb index a309240..5661aa2 100644 --- a/lib/rosette_api.rb +++ b/lib/rosette_api.rb @@ -9,35 +9,35 @@ # This class allows you to access all Rosette API endpoints. class RosetteAPI # Version of Ruby binding - BINDING_VERSION = '1.4.0' + BINDING_VERSION = '1.4.0'.freeze # Rosette API language endpoint - LANGUAGE_ENDPOINT = '/language' + LANGUAGE_ENDPOINT = '/language'.freeze # Rosette API morphology endpoint - MORPHOLOGY_ENDPOINT = '/morphology' + MORPHOLOGY_ENDPOINT = '/morphology'.freeze # Rosette API entities endpoint - ENTITIES_ENDPOINT = '/entities' + ENTITIES_ENDPOINT = '/entities'.freeze # Rosette API categories endpoint - CATEGORIES_ENDPOINT = '/categories' + CATEGORIES_ENDPOINT = '/categories'.freeze # Rosette API relationships endpoint - RELATIONSHIPS_ENDPOINT = '/relationships' + RELATIONSHIPS_ENDPOINT = '/relationships'.freeze # Rosette API sentiment endpoint - SENTIMENT_ENDPOINT = '/sentiment' + SENTIMENT_ENDPOINT = '/sentiment'.freeze # Rosette API name-translation endpoint - NAME_TRANSLATION_ENDPOINT = '/name-translation' + NAME_TRANSLATION_ENDPOINT = '/name-translation'.freeze # Rosette API name-similarity endpoint - NAME_SIMILARITY_ENDPOINT = '/name-similarity' + NAME_SIMILARITY_ENDPOINT = '/name-similarity'.freeze # Rosette API tokens endpoint - TOKENS_ENDPOINT = '/tokens' + TOKENS_ENDPOINT = '/tokens'.freeze # Rosette API sentences endpoint - SENTENCES_ENDPOINT = '/sentences' + SENTENCES_ENDPOINT = '/sentences'.freeze # Rosette API info endpoint - INFO = '/info' + INFO = '/info'.freeze # Rosette API ping endpoint - PING = '/ping' + PING = '/ping'.freeze # Text Embedding endpoint - TEXT_EMBEDDING = '/text-embedding' + TEXT_EMBEDDING = '/text-embedding'.freeze # Syntactic Dependencies endpoint - SYNTACTIC_DEPENDENCIES_ENDPOINT = '/syntax/dependencies' + SYNTACTIC_DEPENDENCIES_ENDPOINT = '/syntax/dependencies'.freeze # Rosette API key attr_accessor :user_key @@ -45,10 +45,13 @@ class RosetteAPI attr_accessor :alternate_url # custom Rosette API headers attr_accessor :custom_headers + # URL query parameter(s) + attr_accessor :url_parameters - def initialize(user_key, alternate_url = 'https://api.rosette.com/rest/v1') #:notnew: + def initialize(user_key, alternate_url = 'https://api.rosette.com/rest/v1') @user_key = user_key @alternate_url = alternate_url + @url_parameters = nil if @alternate_url.to_s.end_with?('/') @alternate_url = alternate_url.to_s.slice(0..-2) @@ -71,7 +74,7 @@ def get_language(params) params = params.load_params - RequestBuilder.new(@user_key, @alternate_url + LANGUAGE_ENDPOINT, @http_client, params, BINDING_VERSION) + RequestBuilder.new(@user_key, @alternate_url + LANGUAGE_ENDPOINT, @http_client, params, @url_parameters, BINDING_VERSION) .send_post_request end @@ -89,7 +92,7 @@ def get_morphology_complete(params) params = params.load_params - RequestBuilder.new(@user_key, @alternate_url + MORPHOLOGY_ENDPOINT + '/complete', @http_client, params, BINDING_VERSION) + RequestBuilder.new(@user_key, @alternate_url + MORPHOLOGY_ENDPOINT + '/complete', @http_client, params, @url_parameters, BINDING_VERSION) .send_post_request end @@ -106,7 +109,7 @@ def get_compound_components(params) params = params.load_params - RequestBuilder.new(@user_key, @alternate_url + MORPHOLOGY_ENDPOINT + '/compound-components', @http_client, params, BINDING_VERSION) + RequestBuilder.new(@user_key, @alternate_url + MORPHOLOGY_ENDPOINT + '/compound-components', @http_client, params, @url_parameters, BINDING_VERSION) .send_post_request end @@ -123,7 +126,7 @@ def get_han_readings(params) params = params.load_params - RequestBuilder.new(@user_key, @alternate_url + MORPHOLOGY_ENDPOINT + '/han-readings', @http_client, params, BINDING_VERSION) + RequestBuilder.new(@user_key, @alternate_url + MORPHOLOGY_ENDPOINT + '/han-readings', @http_client, params, @url_parameters, BINDING_VERSION) .send_post_request end @@ -139,7 +142,7 @@ def get_lemmas(params) params = params.load_params - RequestBuilder.new(@user_key, @alternate_url + MORPHOLOGY_ENDPOINT + '/lemmas', @http_client, params, BINDING_VERSION) + RequestBuilder.new(@user_key, @alternate_url + MORPHOLOGY_ENDPOINT + '/lemmas', @http_client, params, @url_parameters, BINDING_VERSION) .send_post_request end @@ -156,7 +159,7 @@ def get_parts_of_speech(params) params = params.load_params - RequestBuilder.new(@user_key, @alternate_url + MORPHOLOGY_ENDPOINT + '/parts-of-speech', @http_client, params, BINDING_VERSION) + RequestBuilder.new(@user_key, @alternate_url + MORPHOLOGY_ENDPOINT + '/parts-of-speech', @http_client, params, @url_parameters, BINDING_VERSION) .send_post_request end @@ -173,7 +176,7 @@ def get_entities(params) params = params.load_params endpoint = ENTITIES_ENDPOINT - RequestBuilder.new(@user_key, @alternate_url + endpoint, @http_client, params, BINDING_VERSION) + RequestBuilder.new(@user_key, @alternate_url + endpoint, @http_client, params, @url_parameters, BINDING_VERSION) .send_post_request end @@ -189,7 +192,7 @@ def get_categories(params) params = params.load_params - RequestBuilder.new(@user_key, @alternate_url + CATEGORIES_ENDPOINT, @http_client, params, BINDING_VERSION) + RequestBuilder.new(@user_key, @alternate_url + CATEGORIES_ENDPOINT, @http_client, params, @url_parameters, BINDING_VERSION) .send_post_request end @@ -205,7 +208,7 @@ def get_relationships(params) params = params.load_params - RequestBuilder.new(@user_key, @alternate_url + RELATIONSHIPS_ENDPOINT, @http_client, params, BINDING_VERSION) + RequestBuilder.new(@user_key, @alternate_url + RELATIONSHIPS_ENDPOINT, @http_client, params, @url_parameters, BINDING_VERSION) .send_post_request end @@ -221,7 +224,7 @@ def get_sentiment(params) params = params.load_params - RequestBuilder.new(@user_key, @alternate_url + SENTIMENT_ENDPOINT, @http_client, params, BINDING_VERSION) + RequestBuilder.new(@user_key, @alternate_url + SENTIMENT_ENDPOINT, @http_client, params, @url_parameters, BINDING_VERSION) .send_post_request end @@ -237,7 +240,7 @@ def name_translation(params) params = params.load_params - RequestBuilder.new(@user_key, @alternate_url + NAME_TRANSLATION_ENDPOINT, @http_client, params, BINDING_VERSION) + RequestBuilder.new(@user_key, @alternate_url + NAME_TRANSLATION_ENDPOINT, @http_client, params, @url_parameters, BINDING_VERSION) .send_post_request end @@ -254,7 +257,7 @@ def name_similarity(params) params = params.load_params - RequestBuilder.new(@user_key, @alternate_url + NAME_SIMILARITY_ENDPOINT, @http_client, params, BINDING_VERSION) + RequestBuilder.new(@user_key, @alternate_url + NAME_SIMILARITY_ENDPOINT, @http_client, params, @url_parameters, BINDING_VERSION) .send_post_request end @@ -270,7 +273,7 @@ def get_tokens(params) params = params.load_params - RequestBuilder.new(@user_key, @alternate_url + TOKENS_ENDPOINT, @http_client, params, BINDING_VERSION) + RequestBuilder.new(@user_key, @alternate_url + TOKENS_ENDPOINT, @http_client, params, @url_parameters, BINDING_VERSION) .send_post_request end @@ -286,9 +289,10 @@ def get_sentences(params) params = params.load_params - RequestBuilder.new(@user_key, @alternate_url + SENTENCES_ENDPOINT, @http_client, params, BINDING_VERSION) + RequestBuilder.new(@user_key, @alternate_url + SENTENCES_ENDPOINT, @http_client, params, @url_parameters, BINDING_VERSION) .send_post_request end + # # Returns the vectors associated with the text # @@ -302,7 +306,7 @@ def get_text_embedding(params) params = params.load_params - RequestBuilder.new(@user_key, @alternate_url + TEXT_EMBEDDING, @http_client, params, BINDING_VERSION) + RequestBuilder.new(@user_key, @alternate_url + TEXT_EMBEDDING, @http_client, params, @url_parameters, BINDING_VERSION) .send_post_request end @@ -319,29 +323,28 @@ def get_syntax_dependencies(params) params = params.load_params - RequestBuilder.new(@user_key, @alternate_url + SYNTACTIC_DEPENDENCIES_ENDPOINT, @http_client, params, BINDING_VERSION) + RequestBuilder.new(@user_key, @alternate_url + SYNTACTIC_DEPENDENCIES_ENDPOINT, @http_client, params, @url_parameters, BINDING_VERSION) .send_post_request end # Gets information about the Rosette API, returns name, build number # and build time. def info - RequestBuilder.new(@user_key, @alternate_url + INFO, @http_client, BINDING_VERSION) + RequestBuilder.new(@user_key, @alternate_url + INFO, @http_client, @url_parameters, BINDING_VERSION) .send_get_request end # Pings the Rosette API for a response indicting that the service is # available. def ping - RequestBuilder.new(@user_key, @alternate_url + PING, @http_client, BINDING_VERSION) + RequestBuilder.new(@user_key, @alternate_url + PING, @http_client, @url_parameters, BINDING_VERSION) .send_get_request end private - # Checks that the right parameter type is being passed in. - def check_params(params, message = 'Expects a DocumentParameters type as an argument', type = DocumentParameters) - raise BadRequestError.new message unless params.is_a? type - end + # Checks that the right parameter type is being passed in. + def check_params(params, message = 'Expects a DocumentParameters type as an argument', type = DocumentParameters) + raise BadRequestError.new message unless params.is_a? type + end end - From ec96e201d6b17926f1effa0275224ab7977ecb40 Mon Sep 17 00:00:00 2001 From: Chris Park Date: Mon, 19 Dec 2016 15:23:59 +0000 Subject: [PATCH 5/5] Version 1.5.0 --- lib/rosette_api.rb | 2 +- rosette_api.gemspec | 4 ++-- tests/tests_spec.rb | 34 +++++++++++++++++----------------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/rosette_api.rb b/lib/rosette_api.rb index 5661aa2..df2627f 100644 --- a/lib/rosette_api.rb +++ b/lib/rosette_api.rb @@ -9,7 +9,7 @@ # This class allows you to access all Rosette API endpoints. class RosetteAPI # Version of Ruby binding - BINDING_VERSION = '1.4.0'.freeze + BINDING_VERSION = '1.5.0' # Rosette API language endpoint LANGUAGE_ENDPOINT = '/language'.freeze # Rosette API morphology endpoint diff --git a/rosette_api.gemspec b/rosette_api.gemspec index 1466d05..202c2c0 100644 --- a/rosette_api.gemspec +++ b/rosette_api.gemspec @@ -8,7 +8,7 @@ Gem::Specification.new do |s| s.required_ruby_version = '>= 2.0.0' s.name = 'rosette_api' - s.version = '1.4.0' + s.version = '1.5.0' s.license = 'MIT' s.summary = 'Rosette API gem that supports multilingual text-analytics.' @@ -19,7 +19,7 @@ Gem::Specification.new do |s| s.authors = ['Basis Technology Corp'] s.email = %q{support@rosette.com} s.homepage = %q{https://developer.rosette.com/} - s.date = %q{2016-10-06} + s.date = %q{2016-12-19} all_files = `git ls-files -z`.split("\x0") s.files = all_files.grep(%r{^(bin|lib)/|^.rubocop.yml$}) diff --git a/tests/tests_spec.rb b/tests/tests_spec.rb index e9550ce..4ab6629 100644 --- a/tests/tests_spec.rb +++ b/tests/tests_spec.rb @@ -21,7 +21,7 @@ 'User-Agent' => 'Ruby', 'X-Rosetteapi-Key' => '0123456789', 'X-Rosetteapi-Binding' => 'ruby', - 'X-Rosetteapi-Binding-Version' => '1.4.0'}). + 'X-Rosetteapi-Binding-Version' => '1.5.0'}). to_return(:status => 200, :body => "{\"test\": \"language\"}", :headers => {}) end it 'test language' do @@ -57,7 +57,7 @@ 'User-Agent' => 'Ruby', 'X-Rosetteapi-Key' => '0123456789', 'X-Rosetteapi-Binding' => 'ruby', - 'X-Rosetteapi-Binding-Version' => '1.4.0'}). + 'X-Rosetteapi-Binding-Version' => '1.5.0'}). to_return(:status => 200, :body => "{\"test\": \"morphology/complete\"}", :headers => {}) end it 'test morphology complete' do @@ -78,7 +78,7 @@ 'User-Agent' => 'Ruby', 'X-Rosetteapi-Key' => '0123456789', 'X-Rosetteapi-Binding' => 'ruby', - 'X-Rosetteapi-Binding-Version' => '1.4.0'}). + 'X-Rosetteapi-Binding-Version' => '1.5.0'}). to_return(:status => 200, :body => "{\"test\": \"morphology/compound-components\"}", :headers => {}) end it 'test morphology compound components' do @@ -99,7 +99,7 @@ 'User-Agent' => 'Ruby', 'X-Rosetteapi-Key' => '0123456789', 'X-Rosetteapi-Binding' => 'ruby', - 'X-Rosetteapi-Binding-Version' => '1.4.0'}). + 'X-Rosetteapi-Binding-Version' => '1.5.0'}). to_return(:status => 200, :body => "{\"test\": \"morphology/han-readings\"}", :headers => {}) end it 'test morphology han readings' do @@ -120,7 +120,7 @@ 'User-Agent' => 'Ruby', 'X-Rosetteapi-Key' => '0123456789', 'X-Rosetteapi-Binding' => 'ruby', - 'X-Rosetteapi-Binding-Version' => '1.4.0'}). + 'X-Rosetteapi-Binding-Version' => '1.5.0'}). to_return(:status => 200, :body => "{\"test\": \"morphology/parts-of-speech\"}", :headers => {}) end it 'test morphology parts of speech' do @@ -141,7 +141,7 @@ 'User-Agent' => 'Ruby', 'X-Rosetteapi-Key' => '0123456789', 'X-Rosetteapi-Binding' => 'ruby', - 'X-Rosetteapi-Binding-Version' => '1.4.0'}). + 'X-Rosetteapi-Binding-Version' => '1.5.0'}). to_return(:status => 200, :body => "{\"test\": \"morphology/lemmas\"}", :headers => {}) end it 'test morphology lemmas' do @@ -162,7 +162,7 @@ 'User-Agent' => 'Ruby', 'X-Rosetteapi-Key' => '0123456789', 'X-Rosetteapi-Binding' => 'ruby', - 'X-Rosetteapi-Binding-Version' => '1.4.0'}). + 'X-Rosetteapi-Binding-Version' => '1.5.0'}). to_return(:status => 200, :body => "{\"test\": \"entities\"}", :headers => {}) end it 'test entities' do @@ -184,7 +184,7 @@ 'User-Agent' => 'Ruby', 'X-Rosetteapi-Key' => '0123456789', 'X-Rosetteapi-Binding' => 'ruby', - 'X-Rosetteapi-Binding-Version' => '1.4.0'}). + 'X-Rosetteapi-Binding-Version' => '1.5.0'}). to_return(:status => 200, :body => "{\"test\": \"entities\"}", :headers => {}) end it 'test entities without qids' do @@ -215,7 +215,7 @@ 'User-Agent' => 'Ruby', 'X-Rosetteapi-Key' => '0123456789', 'X-Rosetteapi-Binding' => 'ruby', - 'X-Rosetteapi-Binding-Version' => '1.4.0'}). + 'X-Rosetteapi-Binding-Version' => '1.5.0'}). to_return(:status => 200, :body => "{\"test\": \"categories\"}", :headers => {}) end it 'test categories' do @@ -236,7 +236,7 @@ 'User-Agent' => 'Ruby', 'X-Rosetteapi-Key' => '0123456789', 'X-Rosetteapi-Binding' => 'ruby', - 'X-Rosetteapi-Binding-Version' => '1.4.0'}). + 'X-Rosetteapi-Binding-Version' => '1.5.0'}). to_return(:status => 200, :body => "{\"test\": \"relationships\"}", :headers => {}) end it 'test relationships' do @@ -258,7 +258,7 @@ 'User-Agent' => 'Ruby', 'X-Rosetteapi-Key' => '0123456789', 'X-Rosetteapi-Binding' => 'ruby', - 'X-Rosetteapi-Binding-Version' => '1.4.0'}). + 'X-Rosetteapi-Binding-Version' => '1.5.0'}). to_return(:status => 200, :body => "{\"test\": \"name-translation\"}", :headers => {}) end it 'test name translation' do @@ -285,7 +285,7 @@ 'User-Agent' => 'Ruby', 'X-Rosetteapi-Key' => '0123456789', 'X-Rosetteapi-Binding' => 'ruby', - 'X-Rosetteapi-Binding-Version' => '1.4.0'}). + 'X-Rosetteapi-Binding-Version' => '1.5.0'}). to_return(:status => 200, :body => "{\"test\": \"name-similarity\"}", :headers => {}) end it 'test name similarity' do @@ -320,7 +320,7 @@ 'User-Agent' => 'Ruby', 'X-Rosetteapi-Key' => '0123456789', 'X-Rosetteapi-Binding' => 'ruby', - 'X-Rosetteapi-Binding-Version' => '1.4.0'}). + 'X-Rosetteapi-Binding-Version' => '1.5.0'}). to_return(:status => 200, :body => "{\"test\": \"tokens\"}", :headers => {}) end it 'test tokens' do @@ -341,7 +341,7 @@ 'User-Agent' => 'Ruby', 'X-Rosetteapi-Key' => '0123456789', 'X-Rosetteapi-Binding' => 'ruby', - 'X-Rosetteapi-Binding-Version' => '1.4.0'}). + 'X-Rosetteapi-Binding-Version' => '1.5.0'}). to_return(:status => 200, :body => "{\"test\": \"sentences\"}", :headers => {}) end it 'test sentences' do @@ -392,7 +392,7 @@ 'User-Agent' => 'Ruby', 'X-Rosetteapi-Key' => '0123456789', 'X-Rosetteapi-Binding' => 'ruby', - 'X-Rosetteapi-Binding-Version' => '1.4.0', + 'X-Rosetteapi-Binding-Version' => '1.5.0', 'X-RosetteApi-App' => 'ruby-app'}). to_return(:status => 200, :body => "{\"test\": \"language\"}", :headers => {}) end @@ -429,7 +429,7 @@ 'User-Agent' => 'Ruby', 'X-Rosetteapi-Key' => '0123456789', 'X-Rosetteapi-Binding' => 'ruby', - 'X-Rosetteapi-Binding-Version' => '1.4.0'}). + 'X-Rosetteapi-Binding-Version' => '1.5.0'}). to_return(:status => 200, :body => "{\"test\": \"language\"}", :headers => {}) end it 'test text_embedding' do @@ -450,7 +450,7 @@ 'User-Agent' => 'Ruby', 'X-Rosetteapi-Key' => '0123456789', 'X-Rosetteapi-Binding' => 'ruby', - 'X-Rosetteapi-Binding-Version' => '1.4.0'}). + 'X-Rosetteapi-Binding-Version' => '1.5.0'}). to_return(:status => 200, :body => "{\"test\": \"language\"}", :headers => {}) end it 'test syntax_dependencies' do