SlideShare a Scribd company logo
1 of 6
HOW TO DEVELOP A NEW SERVICE
Three simple steps to develop your own sentiment analysis service using
our language resources and/or services:
1. Sign up on
the project
website
http://portal.eurosentiment.eu/accoun
ts/signin/
2. Obtain an
access token
e.g., 78cab860-d17d-4afa-b1ac-
d6ff84e942d7
3. Sign in with
your
credentials
Fill in a form with the
following fields:
 name
 surname
 e-mail
 type of user
 ...
List tha available services and resources:
Resource: http://140.203.155.231:8890/sparql/{resource_id},
where “resource_id” is a code, e.g., c1eb1886-b3a1-4435-9284-fa1ecd9a8d55
Service: http://217.26.90.243:8080/EuroSentimentServices/services/server/access/{service_id},
where “service_id” is code, e.g., 11eb1886-b3a1-4435-9284-fa1ecd9a8d55
Note that all the HTTP method are POST and all the input parameters are in JSON formats.
Click on the selected service that you want to use to see more info (for instance, input parameters).
e.g., {"input": “The hotel was fantastic. The restaurant was cheap and the room was comfortable."}
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;
import com.sun.jersey.api.client.WebResource.Builder;
public class Services_Client {
public String postClient(String service, String req){
String results = "";
try {
Client client = Client.create();
WebResource webResource = client.resource(service);
Builder b = webResource.header("x-eurosentiment-token", "78cab860-d17d-4afa-
b1ac-d6ff84e942d7 ");
ClientResponse response = b.post(ClientResponse.class, req);
results = response.getEntity(String.class);
} catch (Exception e) {
e.printStackTrace();
}
return results;
}
}
Consume an EUROSENTIMENT service via REST APIs
Suppose that we have chosen the S/E analyzer service from the previous list, which performs sentiment
and emotion analysis on a text. The service performs sentiment analysis with automatic language
detection (for English, Italian, German, Spanish, Catalan, Portuguese) and domain detection (e.g. for hotel
and electronics).
The following shows the Java code to implement a simple REST client. In order to make a request to
EuroSentiment LRP, you must include a new HTTP header field, named x-eurosentiment-token, with the
value of your access-token (e.g., 78cab860-d17d-4afa-b1ac-d6ff84e942d7), as shown below.
Note: in the code above we use Jersey APIs: https://jersey.java.net/download.html
Use the created REST client
At this point, in the “main” class you have to put the text that you want to analyze, i.e., “La stanza dell'hotel era spaziosa
e pulita, sono molto contento. La colazione era abbondante e molto soddisfacente!”, in JSON format.
Input:
JSONObject j = new JSONObject();
j.put("input", "The hotel was fantastic. The restaurant was cheap and the room was comfortable!");
Perform the request to the REST endpoint of the S/E analyzer service that has id, e.g., “sesse0328”.
Call:
String results = Client.postClient(http://217.26.90.243:8080/EuroSentimentServices/services/server/access/sesse0308, j.toString());
{
"@context": "http://eurosentiment.eu/contexts/basecontext.jsonld",
"dc:language": "en",
"domain": "es:Hotel",
"analysis": [ {
"@id":"ex:Analysis",
"@type": [
"marl:SentimentAnalysis",
"onyx:EmotionAnalysis" ],
"marl:minPolarityValue": 0,
"marl:maxPolarityValue": 100,
"onyx:usesEmotionModel": "es:EmotionModel" } ],
"entries": [ {
"nif:isString": "The hotel was fantastic",
"dc:language": "en",
"domain": "es:Hotel",
"opinions": [ {
"@id": "_:Opinion1",
"marl:hasPolarity": "marl:Positive",
"marl:PolarityValue":100,
"marl:describesObject":"hotel" } ],
"emotions": [ ],
"strings": [ {
"nif:anchorOf":"hotel",
"entities": [ "hotel" ] } ] },
The results of the request are shown in JSON and are ready to be used in every service that you will want to implement!
Output:
{
"nif:isString": " The restaurant was cheap and the room was comfortable",
"dc:language": "en",
"domain": "es:Hotel",
"opinions": [ {
"@id": "_:Opinion1",
"marl:hasPolarity": "marl:Positive",
"marl:PolarityValue": 100,
"marl:describesObject": "restaurant" },
{
"@id": "_:Opinion2",
"marl:hasPolarity": "marl:Positive",
"marl:PolarityValue": 100,
"marl:describesObject": "room" } ],
"emotions": [ ],
"strings": [ {
"nif:anchorOf": "restaurant",
"entities": [
"restaurant" ] },
{
"nif:anchorOf": "room",
"entities": [
"room" ] } ] } ]}
public void service_test(){
Services_Client client = new Services_Client();
JSONObject j = new JSONObject();
j.put("input","The hotel was fantastic. The restaurant was cheap and the room was comfortable!");
String results =
client.postClient(“http://217.26.90.243:8080/EuroSentimentServices/services/server/access/sesse0308",
j.toString());
}
Conclusions
The following code is the method resulting from the previous steps; a simple piece of Java code to
consume the S/E analyzer service. You can use this code for accessing every EuroSentiment service by
simply changing the id of the URL.
Now, you can create your own services, using the pre-existing services in the EuroSentiment Language
Resource Pool (LRP)!
Moreover, you can register your own services on the EuroSentiment LRP platform, to:
• Increase visibility and recognition of your services
• Increase ROI of your services
• Increase the value of your services

More Related Content

Similar to Eurosentiment - Developing a new service

[CB16] Esoteric Web Application Vulnerabilities by Andrés Riancho
[CB16] Esoteric Web Application Vulnerabilities by Andrés Riancho[CB16] Esoteric Web Application Vulnerabilities by Andrés Riancho
[CB16] Esoteric Web Application Vulnerabilities by Andrés Riancho
CODE BLUE
 
Evolve Your Schemas in a Better Way! A Deep Dive into Avro Schema Compatibili...
Evolve Your Schemas in a Better Way! A Deep Dive into Avro Schema Compatibili...Evolve Your Schemas in a Better Way! A Deep Dive into Avro Schema Compatibili...
Evolve Your Schemas in a Better Way! A Deep Dive into Avro Schema Compatibili...
HostedbyConfluent
 
Intravert Server side processing for Cassandra
Intravert Server side processing for CassandraIntravert Server side processing for Cassandra
Intravert Server side processing for Cassandra
Edward Capriolo
 
Create a mobile web app with Sencha Touch
Create a mobile web app with Sencha TouchCreate a mobile web app with Sencha Touch
Create a mobile web app with Sencha Touch
James Pearce
 

Similar to Eurosentiment - Developing a new service (20)

SDKs, the good the bad the ugly - Japan
SDKs, the good the bad the ugly - JapanSDKs, the good the bad the ugly - Japan
SDKs, the good the bad the ugly - Japan
 
Insight User Conference Bootcamp - Use the Engagement Tracking and Metrics A...
Insight User Conference Bootcamp - Use the Engagement Tracking  and Metrics A...Insight User Conference Bootcamp - Use the Engagement Tracking  and Metrics A...
Insight User Conference Bootcamp - Use the Engagement Tracking and Metrics A...
 
how to use openstack api
how to use openstack apihow to use openstack api
how to use openstack api
 
SignalR
SignalRSignalR
SignalR
 
[CB16] Esoteric Web Application Vulnerabilities by Andrés Riancho
[CB16] Esoteric Web Application Vulnerabilities by Andrés Riancho[CB16] Esoteric Web Application Vulnerabilities by Andrés Riancho
[CB16] Esoteric Web Application Vulnerabilities by Andrés Riancho
 
Canopy unconference preso
Canopy unconference presoCanopy unconference preso
Canopy unconference preso
 
OneTeam Media Server
OneTeam Media ServerOneTeam Media Server
OneTeam Media Server
 
Altitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, Ever
Altitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, EverAltitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, Ever
Altitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, Ever
 
Evolve Your Schemas in a Better Way! A Deep Dive into Avro Schema Compatibili...
Evolve Your Schemas in a Better Way! A Deep Dive into Avro Schema Compatibili...Evolve Your Schemas in a Better Way! A Deep Dive into Avro Schema Compatibili...
Evolve Your Schemas in a Better Way! A Deep Dive into Avro Schema Compatibili...
 
Life on Clouds: a forensics overview
Life on Clouds: a forensics overviewLife on Clouds: a forensics overview
Life on Clouds: a forensics overview
 
An introduction to the API for OnTime for IBM
An introduction to the API for OnTime for IBMAn introduction to the API for OnTime for IBM
An introduction to the API for OnTime for IBM
 
A mobile web app for Android in 75 minutes
A mobile web app for Android in 75 minutesA mobile web app for Android in 75 minutes
A mobile web app for Android in 75 minutes
 
Tadhack madrid June 2014: Joris Swinnen and WebRTC Nederland "Invite my colle...
Tadhack madrid June 2014: Joris Swinnen and WebRTC Nederland "Invite my colle...Tadhack madrid June 2014: Joris Swinnen and WebRTC Nederland "Invite my colle...
Tadhack madrid June 2014: Joris Swinnen and WebRTC Nederland "Invite my colle...
 
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
 
Intravert Server side processing for Cassandra
Intravert Server side processing for CassandraIntravert Server side processing for Cassandra
Intravert Server side processing for Cassandra
 
Create a mobile web app with Sencha Touch
Create a mobile web app with Sencha TouchCreate a mobile web app with Sencha Touch
Create a mobile web app with Sencha Touch
 
#CNX14 - Dive Deep into the ExactTarget Fuel APIs
#CNX14 - Dive Deep into the ExactTarget Fuel APIs#CNX14 - Dive Deep into the ExactTarget Fuel APIs
#CNX14 - Dive Deep into the ExactTarget Fuel APIs
 
Serious Sencha - Data Layer and Server-Side REST Interface
Serious Sencha - Data Layer and Server-Side REST InterfaceSerious Sencha - Data Layer and Server-Side REST Interface
Serious Sencha - Data Layer and Server-Side REST Interface
 
API-Entwicklung bei XING
API-Entwicklung bei XINGAPI-Entwicklung bei XING
API-Entwicklung bei XING
 
Streaming Operational Data with MariaDB MaxScale
Streaming Operational Data with MariaDB MaxScaleStreaming Operational Data with MariaDB MaxScale
Streaming Operational Data with MariaDB MaxScale
 

Recently uploaded

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Recently uploaded (20)

Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Choreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringChoreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software Engineering
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
API Governance and Monetization - The evolution of API governance
API Governance and Monetization -  The evolution of API governanceAPI Governance and Monetization -  The evolution of API governance
API Governance and Monetization - The evolution of API governance
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Decarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational PerformanceDecarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational Performance
 

Eurosentiment - Developing a new service

  • 1. HOW TO DEVELOP A NEW SERVICE
  • 2. Three simple steps to develop your own sentiment analysis service using our language resources and/or services: 1. Sign up on the project website http://portal.eurosentiment.eu/accoun ts/signin/ 2. Obtain an access token e.g., 78cab860-d17d-4afa-b1ac- d6ff84e942d7 3. Sign in with your credentials Fill in a form with the following fields:  name  surname  e-mail  type of user  ...
  • 3. List tha available services and resources: Resource: http://140.203.155.231:8890/sparql/{resource_id}, where “resource_id” is a code, e.g., c1eb1886-b3a1-4435-9284-fa1ecd9a8d55 Service: http://217.26.90.243:8080/EuroSentimentServices/services/server/access/{service_id}, where “service_id” is code, e.g., 11eb1886-b3a1-4435-9284-fa1ecd9a8d55 Note that all the HTTP method are POST and all the input parameters are in JSON formats. Click on the selected service that you want to use to see more info (for instance, input parameters). e.g., {"input": “The hotel was fantastic. The restaurant was cheap and the room was comfortable."}
  • 4. import com.sun.jersey.api.client.Client; import com.sun.jersey.api.client.ClientResponse; import com.sun.jersey.api.client.WebResource; import com.sun.jersey.api.client.WebResource.Builder; public class Services_Client { public String postClient(String service, String req){ String results = ""; try { Client client = Client.create(); WebResource webResource = client.resource(service); Builder b = webResource.header("x-eurosentiment-token", "78cab860-d17d-4afa- b1ac-d6ff84e942d7 "); ClientResponse response = b.post(ClientResponse.class, req); results = response.getEntity(String.class); } catch (Exception e) { e.printStackTrace(); } return results; } } Consume an EUROSENTIMENT service via REST APIs Suppose that we have chosen the S/E analyzer service from the previous list, which performs sentiment and emotion analysis on a text. The service performs sentiment analysis with automatic language detection (for English, Italian, German, Spanish, Catalan, Portuguese) and domain detection (e.g. for hotel and electronics). The following shows the Java code to implement a simple REST client. In order to make a request to EuroSentiment LRP, you must include a new HTTP header field, named x-eurosentiment-token, with the value of your access-token (e.g., 78cab860-d17d-4afa-b1ac-d6ff84e942d7), as shown below. Note: in the code above we use Jersey APIs: https://jersey.java.net/download.html
  • 5. Use the created REST client At this point, in the “main” class you have to put the text that you want to analyze, i.e., “La stanza dell'hotel era spaziosa e pulita, sono molto contento. La colazione era abbondante e molto soddisfacente!”, in JSON format. Input: JSONObject j = new JSONObject(); j.put("input", "The hotel was fantastic. The restaurant was cheap and the room was comfortable!"); Perform the request to the REST endpoint of the S/E analyzer service that has id, e.g., “sesse0328”. Call: String results = Client.postClient(http://217.26.90.243:8080/EuroSentimentServices/services/server/access/sesse0308, j.toString()); { "@context": "http://eurosentiment.eu/contexts/basecontext.jsonld", "dc:language": "en", "domain": "es:Hotel", "analysis": [ { "@id":"ex:Analysis", "@type": [ "marl:SentimentAnalysis", "onyx:EmotionAnalysis" ], "marl:minPolarityValue": 0, "marl:maxPolarityValue": 100, "onyx:usesEmotionModel": "es:EmotionModel" } ], "entries": [ { "nif:isString": "The hotel was fantastic", "dc:language": "en", "domain": "es:Hotel", "opinions": [ { "@id": "_:Opinion1", "marl:hasPolarity": "marl:Positive", "marl:PolarityValue":100, "marl:describesObject":"hotel" } ], "emotions": [ ], "strings": [ { "nif:anchorOf":"hotel", "entities": [ "hotel" ] } ] }, The results of the request are shown in JSON and are ready to be used in every service that you will want to implement! Output: { "nif:isString": " The restaurant was cheap and the room was comfortable", "dc:language": "en", "domain": "es:Hotel", "opinions": [ { "@id": "_:Opinion1", "marl:hasPolarity": "marl:Positive", "marl:PolarityValue": 100, "marl:describesObject": "restaurant" }, { "@id": "_:Opinion2", "marl:hasPolarity": "marl:Positive", "marl:PolarityValue": 100, "marl:describesObject": "room" } ], "emotions": [ ], "strings": [ { "nif:anchorOf": "restaurant", "entities": [ "restaurant" ] }, { "nif:anchorOf": "room", "entities": [ "room" ] } ] } ]}
  • 6. public void service_test(){ Services_Client client = new Services_Client(); JSONObject j = new JSONObject(); j.put("input","The hotel was fantastic. The restaurant was cheap and the room was comfortable!"); String results = client.postClient(“http://217.26.90.243:8080/EuroSentimentServices/services/server/access/sesse0308", j.toString()); } Conclusions The following code is the method resulting from the previous steps; a simple piece of Java code to consume the S/E analyzer service. You can use this code for accessing every EuroSentiment service by simply changing the id of the URL. Now, you can create your own services, using the pre-existing services in the EuroSentiment Language Resource Pool (LRP)! Moreover, you can register your own services on the EuroSentiment LRP platform, to: • Increase visibility and recognition of your services • Increase ROI of your services • Increase the value of your services