Skip to content

Commit

Permalink
Updated examples to match needed format for slate
Browse files Browse the repository at this point in the history
  • Loading branch information
fiona committed May 4, 2016
1 parent 63400a6 commit 028826c
Show file tree
Hide file tree
Showing 15 changed files with 33 additions and 19 deletions.
3 changes: 2 additions & 1 deletion examples/categories.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
rosette_api = RosetteAPI.new(api_key, url)
end

params = DocumentParameters.new(content_uri: 'http://www.onlocationvacations.com/2015/03/05/the-new-ghostbusters-movie-begins-filming-in-boston-in-june/')
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)
3 changes: 2 additions & 1 deletion examples/entities.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
rosette_api = RosetteAPI.new(api_key, url)
end

params = DocumentParameters.new(content: '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)
response = rosette_api.get_entities(params)
puts JSON.pretty_generate(response)
3 changes: 2 additions & 1 deletion examples/entities_linked.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
rosette_api = RosetteAPI.new(api_key, url)
end

params = DocumentParameters.new(content: '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.', genre: 'social-media')
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)
3 changes: 2 additions & 1 deletion examples/language.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
rosette_api = RosetteAPI.new(api_key, url)
end

params = DocumentParameters.new(content: 'Por favor Señorita, says the man.?')
language_data = 'Por favor Señorita, says the man.?'
params = DocumentParameters.new(content: language_data)
response = rosette_api.get_language(params)
puts JSON.pretty_generate(response)
3 changes: 2 additions & 1 deletion examples/morphology_complete.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
rosette_api = RosetteAPI.new(api_key, url)
end

params = DocumentParameters.new(content: 'The quick brown fox jumped over the lazy dog. Yes he did.')
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)
3 changes: 2 additions & 1 deletion examples/morphology_compound-components.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
rosette_api = RosetteAPI.new(api_key, url)
end

params = DocumentParameters.new(content: 'Rechtsschutzversicherungsgesellschaften')
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)
3 changes: 2 additions & 1 deletion examples/morphology_han-readings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
rosette_api = RosetteAPI.new(api_key, url)
end

params = DocumentParameters.new(content: '北京大学生物系主任办公室内部会议')
morphology_han_readings_data = '北京大学生物系主任办公室内部会议'
params = DocumentParameters.new(content: morphology_han_readings_data)
response = rosette_api.get_han_readings(params)
puts JSON.pretty_generate(response)
3 changes: 2 additions & 1 deletion examples/morphology_lemmas.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
rosette_api = RosetteAPI.new(api_key, url)
end

params = DocumentParameters.new(content: "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"
params = DocumentParameters.new(content: morphology_lemmas_data)
response = rosette_api.get_lemmas(params)
puts JSON.pretty_generate(response)
3 changes: 2 additions & 1 deletion examples/morphology_parts-of-speech.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
rosette_api = RosetteAPI.new(api_key, url)
end

params = DocumentParameters.new(content: "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"
params = DocumentParameters.new(content: morphology_parts_of_speech_data)
response = rosette_api.get_parts_of_speech(params)
puts JSON.pretty_generate(response)
7 changes: 4 additions & 3 deletions examples/name_similarity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
rosette_api = RosetteAPI.new(api_key, url)
end


name1 = NameParameter.new('Michael Jackson', entity_type: 'PERSON', language:'eng')
params = NameSimilarityParameters.new(name1, '迈克尔·杰克逊')
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)
3 changes: 2 additions & 1 deletion examples/name_translation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
rosette_api = RosetteAPI.new(api_key, url)
end

params = NameTranslationParameters.new('معمر محمد أبو منيار القذاف', 'eng', target_script: 'Latn')
translated_name_data = 'معمر محمد أبو منيار القذاف'
params = NameTranslationParameters.new(translated_name_data, 'eng', target_script: 'Latn')
response = rosette_api.name_translation(params)
puts JSON.pretty_generate(response)
3 changes: 2 additions & 1 deletion examples/relationships.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
rosette_api = RosetteAPI.new(api_key, url)
end

params = DocumentParameters.new(content: 'The Ghostbusters movie was filmed in Boston.')
relationships_text_data = 'The Ghostbusters movie was filmed in Boston.'
params = DocumentParameters.new(content: relationships_text_data)
response = rosette_api.get_relationships(params)
puts JSON.pretty_generate(response)
5 changes: 3 additions & 2 deletions examples/sentences.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
rosette_api = RosetteAPI.new(api_key, url)
end

params = DocumentParameters.new
params.content = 'This land is your land. This land is my land\nFrom California to the New York island;\nFrom the' \
sentences_data = 'This land is your land. This land is my land\nFrom California to the New York island;\nFrom the' \
' 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)
4 changes: 2 additions & 2 deletions examples/sentiment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@


file = Tempfile.new(%w(foo .html))
sentiment_text_data = '<html><head><title>New Ghostbusters Film</title></head><body><p>Original Ghostbuster Dan ' \
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_text_data)
file.write(sentiment_file_data)
file.close
params = DocumentParameters.new(file_path: file.path, language: 'eng')
response = rosette_api.get_sentiment(params)
Expand Down
3 changes: 2 additions & 1 deletion examples/tokens.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
rosette_api = RosetteAPI.new(api_key, url)
end

params = DocumentParameters.new(content: '北京大学生物系主任办公室内部会议')
tokens_data = '北京大学生物系主任办公室内部会议'
params = DocumentParameters.new(content: tokens_data)
response = rosette_api.get_tokens(params)
puts JSON.pretty_generate(response)

0 comments on commit 028826c

Please sign in to comment.