Skip to content

Commit 4184b5f

Browse files
committed
Merge branch 'develop'
2 parents 4ffe5b3 + 62d8a97 commit 4184b5f

19 files changed

+107
-65
lines changed

Jenkinsfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ node {
88
checkout scm
99
}
1010
stage("Test with Docker") {
11-
withEnv(["API_KEY=${env.ROSETTE_API_KEY}", "ALT_URL=${env.BINDING_TEST_URL}"]) {
11+
echo "${env.ALT_URL}"
12+
def useUrl = ("${env.ALT_URL}" == "null") ? "${env.BINDING_TEST_URL}" : "${env.ALT_URL}"
13+
withEnv(["API_KEY=${env.ROSETTE_API_KEY}", "ALT_URL=${useUrl}"]) {
1214
sh "docker run --rm -e API_KEY=${API_KEY} -e ALT_URL=${ALT_URL} -v ${SOURCEDIR}:/source rosetteapi/docker-ruby"
1315
}
1416
}

Jenkinsfile.examples

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@ node {
1111
}
1212
stage("Build Dockerfile") {
1313
dir ("${DOCKERFILE_DIR}") {
14-
docker.build("${TEST_CONTAINER}")
14+
sh "docker build --no-cache -t ${TEST_CONTAINER} ."
1515
}
1616
}
1717
stage("Run Examples") {
18-
withEnv(["API_KEY=${env.ROSETTE_API_KEY}", "ALT_URL=${env.BINDING_TEST_URL}"]) {
19-
sh "docker run --rm -e API_KEY=${API_KEY} -e ALT_URL=${ALT_URL} -v ${SOURCEDIR}:/source ${TEST_CONTAINER}"
18+
echo "${env.ALT_URL}"
19+
def useUrl = ("${env.ALT_URL}" == "null") ? "${env.BINDING_TEST_URL}" : "${env.ALT_URL}"
20+
withEnv(["API_KEY=${env.ROSETTE_API_KEY}", "ALT_URL=${useUrl}"]) { sh "docker run --rm -e API_KEY=${API_KEY} -e ALT_URL=${ALT_URL} -v ${SOURCEDIR}:/source ${TEST_CONTAINER}"
2021
}
2122
}
2223
slack(true)

examples/categories.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
rosette_api = RosetteAPI.new(api_key, url)
99
end
1010

11-
categories_url_data = 'http://www.onlocationvacations.com/2015/03/05/the-new-ghostbusters-movie-begins-filming-in-boston-in-june/'
11+
categories_url_data = "http://www.onlocationvacations.com/2015/03/05/the-new-ghostbusters-movie-begins-filming-in-boston-in-june/"
1212
begin
1313
params = DocumentParameters.new(content_uri: categories_url_data)
1414
response = rosette_api.get_categories(params)

examples/entities.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
rosette_api = RosetteAPI.new(api_key, url)
1010
end
1111

12-
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+
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."
1313
begin
1414
params = DocumentParameters.new(content: entities_text_data, genre: 'social-media')
1515
response = rosette_api.get_entities(params)

examples/language_multilingual.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
require 'rosette_api'
2+
3+
api_key, url = ARGV
4+
5+
if !url
6+
rosette_api = RosetteAPI.new(api_key)
7+
else
8+
rosette_api = RosetteAPI.new(api_key, url)
9+
end
10+
11+
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 موقوفين من منظمة \"د هـ ك ب ج\" الذين كانت قد أوقفتهم الشرطة اليونانية في وقت سابق كانوا يخططون لاغتيال الرئيس التركي رجب طيب أردوغان."
12+
begin
13+
params = DocumentParameters.new(content: language_multilingual_data)
14+
params.rosette_options = { 'multilingual' => 'true' }
15+
params.custom_headers = { 'X-RosetteAPI-App' => 'ruby-app' }
16+
response = rosette_api.get_language(params)
17+
puts JSON.pretty_generate(response)
18+
rescue RosetteAPIError => rosette_api_error
19+
printf('Rosette API Error (%s): %s', rosette_api_error.status_code, rosette_api_error.message)
20+
end

examples/morphology_complete.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
rosette_api = RosetteAPI.new(api_key, url)
99
end
1010

11-
morphology_complete_data = "The quick brown fox jumped over the lazy dog. Yes he did."
11+
morphology_complete_data = "The quick brown fox jumped over the lazy dog. 👍🏾 Yes he did. B)"
1212
begin
1313
params = DocumentParameters.new(content: morphology_complete_data)
1414
response = rosette_api.get_morphology_complete(params)

examples/name_deduplication.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
rosette_api = RosetteAPI.new(api_key, url)
99
end
1010

11-
name_dedupe_data = 'John Smith,Johnathon Smith,Fred Jones'
11+
name_dedupe_data = "Alice Terry,Alice Thierry,Betty Grable,Betty Gable,Norma Shearer,Norm Shearer,Brigitte Helm,Bridget Helem,Judy Holliday,Julie Halliday"
1212

1313
threshold = 0.75
1414
names = name_dedupe_data.split(',').map { |n| NameParameter.new(n) }

examples/name_similarity.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
rosette_api = RosetteAPI.new(api_key, url)
99
end
1010

11-
matched_name_data1 = 'Michael Jackson'
12-
matched_name_data2 = '迈克尔·杰克逊'
11+
matched_name_data1 = "Michael Jackson"
12+
matched_name_data2 = "迈克尔·杰克逊"
1313
begin
1414
name1 = NameParameter.new(matched_name_data1, entity_type: 'PERSON', language: 'eng')
1515
params = NameSimilarityParameters.new(name1, matched_name_data2)

examples/name_translation.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
rosette_api = RosetteAPI.new(api_key, url)
99
end
1010

11-
translated_name_data = 'معمر محمد أبو منيار القذاف'
11+
translated_name_data = "معمر محمد أبو منيار القذاف"
1212
begin
1313
params = NameTranslationParameters.new(translated_name_data, 'eng', target_script: 'Latn')
1414
response = rosette_api.get_name_translation(params)

examples/relationships.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
rosette_api = RosetteAPI.new(api_key, url)
99
end
1010

11-
relationships_text_data = "Bill Gates, Microsoft's former CEO, is a philanthropist."
11+
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."
1212
begin
1313
params = DocumentParameters.new(content: relationships_text_data)
1414
params.rosette_options = { accuracyMode: 'PRECISION' }

0 commit comments

Comments
 (0)