Skip to content
This repository was archived by the owner on Dec 5, 2021. It is now read-only.

Commit a766603

Browse files
author
Chris Park
committed
Merge branch 'develop'
2 parents 6f6af26 + e6eb7a6 commit a766603

File tree

6 files changed

+26
-8
lines changed

6 files changed

+26
-8
lines changed

examples/relationships.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@
1010

1111
relationships_text_data = 'The Ghostbusters movie was filmed in Boston.'
1212
params = DocumentParameters.new(content: relationships_text_data)
13+
params.rosette_options = { "accuracyMode" => "PRECISION" }
1314
response = rosette_api.get_relationships(params)
14-
puts JSON.pretty_generate(response)
15+
puts JSON.pretty_generate(response)

lib/document_parameters.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,24 @@ class DocumentParameters
1313
attr_accessor :genre
1414
# ISO 639-3 language code of the provided content (optional)
1515
attr_accessor :language
16+
# Rosette API options (optional, should be a hash)
17+
attr_accessor :rosette_options
1618

1719
def initialize(options = {}) #:notnew:
1820
options = {
1921
content: nil,
2022
content_uri: nil,
2123
file_path: nil,
2224
genre: nil,
23-
language: nil
25+
language: nil,
26+
rosette_options: nil
2427
}.update options
2528
@content = options[:content]
2629
@content_uri = options[:content_uri]
2730
@file_path = options[:file_path]
2831
@genre = options[:genre]
2932
@language = options[:language]
33+
@rosette_options = options[:rosette_options]
3034
end
3135

3236
# Validates the parameters by checking if there are multiple content sources
@@ -60,7 +64,9 @@ def to_hash
6064
content: @content,
6165
content_uri: @content_uri,
6266
file_path: @file_path,
63-
language: @language
67+
genre: @genre,
68+
language: @language,
69+
options: @rosette_options
6470
}
6571
end
6672
end

lib/name_similarity_parameters.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@
66
class NameSimilarityParameters
77
# genre to categorize the input data
88
attr_accessor :genre
9+
# Rosette API options (optional, should be a hash)
10+
attr_accessor :rosette_options
911
# Name to be compared to name2
1012
attr_accessor :name1
1113
# Name to be compared to name1
1214
attr_accessor :name2
1315

1416
def initialize(name1, name2, options = {}) #:notnew:
1517
options = {
16-
genre: nil
18+
genre: nil,
19+
rosette_options: nil
1720
}.update options
1821
@genre = options[:genre]
1922
@name1 = name1
@@ -45,8 +48,10 @@ def load_params
4548
# Returns the new Hash.
4649
def to_hash
4750
{
51+
genre: @genre,
4852
name1: @name1.is_a?(NameParameter) ? @name1.load_param : @name1,
49-
name2: @name2.is_a?(NameParameter) ? @name2.load_param : @name2
53+
name2: @name2.is_a?(NameParameter) ? @name2.load_param : @name2,
54+
options: @rosette_options
5055
}
5156
end
5257
end

lib/name_translation_parameters.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ class NameTranslationParameters
99
attr_accessor :genre
1010
# Name to translate
1111
attr_accessor :name
12+
# Rosette API options (optional, should be a hash)
13+
attr_accessor :rosette_options
1214
# ISO 693-3 code of the name's native language the name originates in (optional)
1315
attr_accessor :source_language_of_origin
1416
# ISO 693-3 code of the name's language of use (optional)
@@ -26,6 +28,7 @@ def initialize(name, target_language, options = {}) #:notnew:
2628
options = {
2729
entity_type: nil,
2830
genre: nil,
31+
rosette_options: nil,
2932
source_language_of_origin: nil,
3033
source_language_of_use: nil,
3134
source_script: nil,
@@ -35,6 +38,7 @@ def initialize(name, target_language, options = {}) #:notnew:
3538
@name = name
3639
@entity_type = options[:entity_type]
3740
@genre = options[:genre]
41+
@rosette_options = options[:rosette_options]
3842
@source_language_of_origin = options[:source_language_of_origin]
3943
@source_language_of_use = options[:source_language_of_use]
4044
@source_script = options[:source_script]
@@ -58,7 +62,9 @@ def load_params
5862
def to_hash
5963
{
6064
entity_type: @entity_type,
65+
genre: @genre,
6166
name: @name,
67+
options: @rosette_options,
6268
source_language_of_origin: @source_language_of_origin,
6369
source_language_of_use: @source_language_of_use,
6470
source_script: @source_script,

lib/rosette_api.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# This class allows you to access all Rosette API endpoints.
1010
class RosetteAPI
1111
# Version of Ruby binding
12-
BINDING_VERSION = '1.0.2'
12+
BINDING_VERSION = '1.1.0'
1313
# Rosette API language endpoint
1414
LANGUAGE_ENDPOINT = '/language'
1515
# Rosette API morphology endpoint

rosette_api.gemspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
88
s.required_ruby_version = '>= 2.0.0'
99

1010
s.name = 'rosette_api'
11-
s.version = '1.0.3'
11+
s.version = '1.1.0'
1212
s.license = 'MIT'
1313

1414
s.summary = 'Rosette API gem that supports multilingual text-analytics.'
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
1919
s.authors = ['Basis Technology Corp']
2020
s.email = %q{support@rosette.com}
2121
s.homepage = %q{https://developer.rosette.com/}
22-
s.date = %q{2016-05-03}
22+
s.date = %q{2016-06-01}
2323

2424
all_files = `git ls-files -z`.split("\x0")
2525
s.files = all_files.grep(%r{^(bin|lib)/|^.rubocop.yml$})

0 commit comments

Comments
 (0)