Skip to content

Commit 823594f

Browse files
author
Chris Park
committed
Merge branch 'develop'
2 parents 757e575 + ec96e20 commit 823594f

26 files changed

+519
-169
lines changed

.rubocop.yml

Lines changed: 312 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,312 @@
1+
# This configuration was generated by
2+
# `rubocop --auto-gen-config`
3+
# on 2016-12-07 10:52:04 -0500 using RuboCop version 0.46.0.
4+
# The point is for the user to remove these configuration records
5+
# one by one as the offenses are removed from the code base.
6+
# Note that changes in the inspected code, or installation of new
7+
# versions of RuboCop, may require this file to be generated again.
8+
9+
# Offense count: 1
10+
# Configuration parameters: Include.
11+
# Include: **/Gemfile, **/gems.rb
12+
Bundler/OrderedGems:
13+
Exclude:
14+
- 'Gemfile'
15+
16+
# Offense count: 2
17+
Lint/Void:
18+
Exclude:
19+
- 'examples/sentences.rb'
20+
- 'examples/sentiment.rb'
21+
22+
# Offense count: 3
23+
Metrics/AbcSize:
24+
Max: 41
25+
26+
# Offense count: 4
27+
# Configuration parameters: CountComments.
28+
Metrics/BlockLength:
29+
Max: 425
30+
31+
# Offense count: 2
32+
# Configuration parameters: CountComments.
33+
Metrics/ClassLength:
34+
Max: 140
35+
36+
# Offense count: 142
37+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
38+
# URISchemes: http, https
39+
Metrics/LineLength:
40+
Max: 408
41+
42+
# Offense count: 6
43+
# Configuration parameters: CountComments.
44+
Metrics/MethodLength:
45+
Max: 42
46+
47+
# Offense count: 1
48+
# Configuration parameters: CountKeywordArgs.
49+
Metrics/ParameterLists:
50+
Max: 6
51+
52+
# Offense count: 94
53+
# Cop supports --auto-correct.
54+
# Configuration parameters: EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle, SupportedLastArgumentHashStyles.
55+
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
56+
Style/AlignHash:
57+
Exclude:
58+
- 'tests/tests_spec.rb'
59+
60+
# Offense count: 1
61+
# Cop supports --auto-correct.
62+
# Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, FunctionalMethods, IgnoredMethods.
63+
# SupportedStyles: line_count_based, semantic, braces_for_chaining
64+
# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
65+
# FunctionalMethods: let, let!, subject, watch
66+
# IgnoredMethods: lambda, proc, it
67+
Style/BlockDelimiters:
68+
Exclude:
69+
- 'tests/tests_spec.rb'
70+
71+
# Offense count: 1
72+
# Cop supports --auto-correct.
73+
Style/BlockEndNewline:
74+
Exclude:
75+
- 'tests/tests_spec.rb'
76+
77+
# Offense count: 18
78+
# Cop supports --auto-correct.
79+
# Configuration parameters: EnforcedStyle, SupportedStyles, SingleLineConditionsOnly.
80+
# SupportedStyles: assign_to_condition, assign_inside_condition
81+
Style/ConditionalAssignment:
82+
Enabled: false
83+
84+
# Offense count: 40
85+
# Cop supports --auto-correct.
86+
# Configuration parameters: EnforcedStyle, SupportedStyles.
87+
# SupportedStyles: leading, trailing
88+
Style/DotPosition:
89+
Exclude:
90+
- 'tests/tests_spec.rb'
91+
92+
# Offense count: 1
93+
# Cop supports --auto-correct.
94+
# Configuration parameters: AllowAdjacentOneLineDefs.
95+
Style/EmptyLineBetweenDefs:
96+
Exclude:
97+
- 'lib/rosette_api.rb'
98+
99+
# Offense count: 4
100+
# Cop supports --auto-correct.
101+
Style/EmptyLines:
102+
Exclude:
103+
- 'examples/sentiment.rb'
104+
- 'lib/request_builder.rb'
105+
- 'rosette_api.gemspec'
106+
107+
# Offense count: 2
108+
# Cop supports --auto-correct.
109+
# Configuration parameters: EnforcedStyle, SupportedStyles.
110+
# SupportedStyles: empty_lines, no_empty_lines
111+
Style/EmptyLinesAroundBlockBody:
112+
Exclude:
113+
- 'tests/tests_spec.rb'
114+
115+
# Offense count: 1
116+
# Cop supports --auto-correct.
117+
Style/EmptyLinesAroundMethodBody:
118+
Exclude:
119+
- 'lib/request_builder.rb'
120+
121+
# Offense count: 3
122+
# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts.
123+
Style/FileName:
124+
Exclude:
125+
- 'examples/morphology_compound-components.rb'
126+
- 'examples/morphology_han-readings.rb'
127+
- 'examples/morphology_parts-of-speech.rb'
128+
129+
# Offense count: 2
130+
# Configuration parameters: SupportedStyles.
131+
# SupportedStyles: for, each
132+
Style/For:
133+
EnforcedStyle: for
134+
135+
# Offense count: 30
136+
# Cop supports --auto-correct.
137+
# Configuration parameters: EnforcedStyle, SupportedStyles.
138+
# SupportedStyles: when_needed, always
139+
Style/FrozenStringLiteralComment:
140+
Enabled: false
141+
142+
# Offense count: 4
143+
# Configuration parameters: MinBodyLength.
144+
Style/GuardClause:
145+
Exclude:
146+
- 'lib/name_similarity_parameters.rb'
147+
- 'lib/name_translation_parameters.rb'
148+
- 'lib/request_builder.rb'
149+
150+
# Offense count: 90
151+
# Cop supports --auto-correct.
152+
# Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
153+
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
154+
Style/HashSyntax:
155+
Exclude:
156+
- 'tests/tests_spec.rb'
157+
158+
# Offense count: 3
159+
# Cop supports --auto-correct.
160+
# Configuration parameters: EnforcedStyle, SupportedStyles.
161+
# SupportedStyles: normal, rails
162+
Style/IndentationConsistency:
163+
Exclude:
164+
- 'examples/sentences.rb'
165+
- 'examples/sentiment.rb'
166+
- 'lib/rosette_api.rb'
167+
168+
# Offense count: 5
169+
# Cop supports --auto-correct.
170+
# Configuration parameters: Width.
171+
Style/IndentationWidth:
172+
Exclude:
173+
- 'examples/morphology_han-readings.rb'
174+
- 'lib/request_builder.rb'
175+
- 'tests/tests_spec.rb'
176+
177+
# Offense count: 1
178+
# Cop supports --auto-correct.
179+
Style/MultilineBlockLayout:
180+
Exclude:
181+
- 'tests/tests_spec.rb'
182+
183+
# Offense count: 41
184+
# Cop supports --auto-correct.
185+
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
186+
# SupportedStyles: aligned, indented, indented_relative_to_receiver
187+
Style/MultilineMethodCallIndentation:
188+
Exclude:
189+
- 'tests/tests_spec.rb'
190+
191+
# Offense count: 15
192+
# Cop supports --auto-correct.
193+
Style/MutableConstant:
194+
Exclude:
195+
- 'lib/rosette_api.rb'
196+
197+
# Offense count: 1
198+
# Cop supports --auto-correct.
199+
Style/NegatedIf:
200+
Exclude:
201+
- 'lib/name_translation_parameters.rb'
202+
203+
# Offense count: 1
204+
# Cop supports --auto-correct.
205+
# Configuration parameters: IncludeSemanticChanges.
206+
Style/NonNilCheck:
207+
Exclude:
208+
- 'lib/request_builder.rb'
209+
210+
# Offense count: 2
211+
Style/OptionalArguments:
212+
Exclude:
213+
- 'lib/request_builder.rb'
214+
215+
# Offense count: 4
216+
# Cop supports --auto-correct.
217+
# Configuration parameters: PreferredDelimiters.
218+
Style/PercentLiteralDelimiters:
219+
Exclude:
220+
- 'rosette_api.gemspec'
221+
222+
# Offense count: 8
223+
# Cop supports --auto-correct.
224+
# Configuration parameters: SupportedStyles.
225+
# SupportedStyles: compact, exploded
226+
Style/RaiseArgs:
227+
EnforcedStyle: compact
228+
229+
# Offense count: 7
230+
# Cop supports --auto-correct.
231+
Style/RedundantSelf:
232+
Exclude:
233+
- 'lib/document_parameters.rb'
234+
- 'lib/name_parameter.rb'
235+
- 'lib/name_similarity_parameters.rb'
236+
- 'lib/name_translation_parameters.rb'
237+
238+
# Offense count: 1
239+
# Cop supports --auto-correct.
240+
Style/SpaceAfterColon:
241+
Exclude:
242+
- 'examples/name_similarity.rb'
243+
244+
# Offense count: 2
245+
# Cop supports --auto-correct.
246+
# Configuration parameters: AllowForAlignment.
247+
Style/SpaceAroundOperators:
248+
Exclude:
249+
- 'examples/language.rb'
250+
- 'rosette_api.gemspec'
251+
252+
# Offense count: 56
253+
# Cop supports --auto-correct.
254+
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles.
255+
# SupportedStyles: space, no_space, compact
256+
Style/SpaceInsideHashLiteralBraces:
257+
Exclude:
258+
- 'examples/language.rb'
259+
- 'tests/tests_spec.rb'
260+
261+
# Offense count: 44
262+
# Cop supports --auto-correct.
263+
# Configuration parameters: EnforcedStyle, SupportedStyles, ConsistentQuotesInMultiline.
264+
# SupportedStyles: single_quotes, double_quotes
265+
Style/StringLiterals:
266+
Exclude:
267+
- 'Gemfile'
268+
- 'examples/categories.rb'
269+
- 'examples/entities.rb'
270+
- 'examples/language.rb'
271+
- 'examples/morphology_complete.rb'
272+
- 'examples/morphology_compound-components.rb'
273+
- 'examples/morphology_han-readings.rb'
274+
- 'examples/name_similarity.rb'
275+
- 'examples/name_translation.rb'
276+
- 'examples/sentiment.rb'
277+
- 'examples/syntax_dependencies.rb'
278+
- 'examples/tokens.rb'
279+
- 'tests/tests_spec.rb'
280+
281+
# Offense count: 14
282+
# Cop supports --auto-correct.
283+
# Configuration parameters: EnforcedStyle, SupportedStyles.
284+
# SupportedStyles: final_newline, final_blank_line
285+
Style/TrailingBlankLines:
286+
Exclude:
287+
- 'examples/info.rb'
288+
- 'examples/language.rb'
289+
- 'examples/morphology_compound-components.rb'
290+
- 'examples/morphology_han-readings.rb'
291+
- 'examples/morphology_lemmas.rb'
292+
- 'examples/morphology_parts-of-speech.rb'
293+
- 'examples/name_similarity.rb'
294+
- 'examples/name_translation.rb'
295+
- 'examples/ping.rb'
296+
- 'examples/sentences.rb'
297+
- 'examples/sentiment.rb'
298+
- 'examples/tokens.rb'
299+
- 'lib/rosette_api.rb'
300+
- 'lib/rosette_api_error.rb'
301+
302+
# Offense count: 1
303+
# Cop supports --auto-correct.
304+
Style/TrailingWhitespace:
305+
Exclude:
306+
- 'lib/request_builder.rb'
307+
308+
# Offense count: 4
309+
# Cop supports --auto-correct.
310+
Style/UnneededPercentQ:
311+
Exclude:
312+
- 'rosette_api.gemspec'

examples/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ Each example, when run, prints its output to the console.
2222
| ------------- |------------- |
2323
| categories.rb | Gets the category of a document at a URL |
2424
| entities.rb | Gets the entities from a piece of text |
25-
| entities_linked.rb | Gets the linked (to Wikipedia) entities from a piece of text |
2625
| info.rb | Gets information about Rosette API |
2726
| language.rb | Gets the language of a piece of text |
2827
| name_similarity.rb | Gets the similarity score of two names |

examples/categories.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
end
1010

1111
categories_url_data = "http://www.onlocationvacations.com/2015/03/05/the-new-ghostbusters-movie-begins-filming-in-boston-in-june/"
12-
params = DocumentParameters.new(content_uri: categories_url_data)
13-
response = rosette_api.get_categories(params)
14-
puts JSON.pretty_generate(response)
12+
begin
13+
params = DocumentParameters.new(content_uri: categories_url_data)
14+
response = rosette_api.get_categories(params)
15+
puts JSON.pretty_generate(response)
16+
rescue RosetteAPIError => rosette_api_error
17+
printf("Rosette API Error (%s): %s", rosette_api_error.status_code, rosette_api_error.message)
18+
end

examples/entities.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# encoding: UTF-8
12
require 'rosette_api'
23

34
api_key, url = ARGV
@@ -9,6 +10,10 @@
910
end
1011

1112
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"
12-
params = DocumentParameters.new(content: entities_text_data, genre: 'social-media')
13-
response = rosette_api.get_entities(params)
14-
puts JSON.pretty_generate(response)
13+
begin
14+
params = DocumentParameters.new(content: entities_text_data, genre: 'social-media')
15+
response = rosette_api.get_entities(params)
16+
puts JSON.pretty_generate(response)
17+
rescue RosetteAPIError => rosette_api_error
18+
printf("Rosette API Error (%s): %s", rosette_api_error.status_code, rosette_api_error.message)
19+
end

examples/entities_linked.rb

Lines changed: 0 additions & 14 deletions
This file was deleted.

examples/info.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,8 @@
88
rosette_api = RosetteAPI.new(api_key, url)
99
end
1010
response = rosette_api.info
11-
puts JSON.pretty_generate(response)
11+
begin
12+
puts JSON.pretty_generate(response)
13+
rescue RosetteAPIError => rosette_api_error
14+
printf("Rosette API Error (%s): %s", rosette_api_error.status_code, rosette_api_error.message)
15+
end

examples/language.rb

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@
99
end
1010

1111
language_data = "Por favor Señorita, says the man."
12-
params = DocumentParameters.new(content: language_data)
13-
params.custom_headers = { 'X-RosetteAPI-App'=> 'ruby-app'}
14-
response = rosette_api.get_language(params)
15-
puts JSON.pretty_generate(response)
12+
begin
13+
params = DocumentParameters.new(content: language_data)
14+
params.custom_headers = { 'X-RosetteAPI-App'=> 'ruby-app'}
15+
response = rosette_api.get_language(params)
16+
puts JSON.pretty_generate(response)
17+
rescue RosetteAPIError => rosette_api_error
18+
printf("Rosette API Error (%s): %s", rosette_api_error.status_code, rosette_api_error.message)
19+
end

0 commit comments

Comments
 (0)