Eurosentiment - Developing a new service

50 %
50 %
Information about Eurosentiment - Developing a new service

Published on March 3, 2014

Author: mario_munoz



Tutorial for developing a new service inside Eurosentiment platform.


If you want develop a service using our resources and our services, you should firstly follow these three simple steps. 1. Sign up on the project website Compile a form with the following fields: • name • surname • e-mail • type of user • ... 2. Obtain an access token e.g., 78cab860-d17d-4afa-b1acd6ff84e942d7 3. Sign in with your credentials

After signing in, you’ll be able to see a list of active services and resources. The requested URL will vary for services and resources: Resource:{resource_id}, being resource_id a hash (e.g., c1eb1886-b3a1-4435-9284-fa1ecd9a8d55) Service:{service_id}, being service_id a hash (e.g., 11eb1886-b3a1-4435-9284-fa1ecd9a8d55) Note that all the HTTP method are POST and all the input parameters are in json formats, e.g., {"input": “bla, bla, bla..."}

Now, we enter at the heart of the question: consume an Eurosentiment service via its REST api for developing a new service. Suppose that we have choosen from the previous list the S/E analyzer service which performs sentiment and emotion analysis on a text. The service performs sentiment analysis with automatic language (within english, italian, german, spanish, catalan and portuguese languages) and domain detection (within hotel and electronics domains). The following picture 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 xeurosentiment-token, with the value of your access-token (e.g., 78cab860-d17d-4afa-b1ac-d6ff84e942d7), as you can see in the code below. import import import import com.sun.jersey.api.client.Client; com.sun.jersey.api.client.ClientResponse; com.sun.jersey.api.client.WebResource; 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 =, req); results = response.getEntity(String.class); } catch (Exception e) { e.printStackTrace(); } return results; } } Note: in the code above we use Jersey APIs:

At this point, in the “main” class you have to put the text that you want analyze, i.e., “La stanza dell'hotel era spaziosa e pulita, sono molto contento. La colazione era abbondante e molto soddisfacente!”, in json format. JSONObject j = new JSONObject(); j.put("input", "La stanza dell'hotel era spaziosa e pulita, sono molto contento. La colazione era abbondante e molto soddisfacente!"); Then, you just have to perform the request to the REST endpoint of the S/E analyzer service that has id, e.g., “123456”. String results = Client.postClient(, j.toString()); The results of the request are shown in JSON format and are ready to be used in every service that you'll want to implement! { "@context": "", "lang": "it", "domain":"hotels", "results": { "strings": [ "La stanza dell'hotel era spaziosa e pulita, sono molto contento.", "La colazione era abbondante e molto soddisfacente!" ], "entities": [ { "id":"stanza", "words": {"spazioso": 90.00, "pulito": 90.00}, "emotions": {}, "opinions": {"polarity":"positive", "polarityValue": 90.00} }, { "id":"colazione", "words": {"soddisfacente":90.00}, "emotions": {"satisfaction": 90.00}, "opinions": {"polarity":"positive", "polarityValue": 90.00} } ], "emotions": {"satisfaction": 10.00}, "opinions": {"polarity":"positive", "polarityValue": 90.00}, "provider": "ExpertSystem“ } }

The following code is the method resulting by the previous steps; a simple java code to consume the S/E analyzer service. You can use this code for accessing at every Eurosentiment service simply changing the id of the URL. public void service_test(){ Services_Client client = new Services_Client(); JSONObject j = new JSONObject(); j.put("input","bla bla bla"); String results = client.postClient(“", j.toString()); }

Add a comment

Related presentations

Presentación que realice en el Evento Nacional de Gobierno Abierto, realizado los ...

In this presentation we will describe our experience developing with a highly dyna...

Presentation to the LITA Forum 7th November 2014 Albuquerque, NM

Un recorrido por los cambios que nos generará el wearabletech en el futuro

Um paralelo entre as novidades & mercado em Wearable Computing e Tecnologias Assis...

Microsoft finally joins the smartwatch and fitness tracker game by introducing the...

Related pages

Eurosentiment - Developing a new service - Technology

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.
Read more

Developing a New Workforce - Education -

Developing a New Workforce presented at SimWorld. ... Eurosentiment - Developing a new service. Developing the Telehealth Workforce. Developing Your Workforce.
Read more

Developing New Products.ppt - Documents

Developing New Markets Learn marketing keys from Belinda Engelhart with the Small Business Development Center. This will help your business as you ...
Read more

Developing A New Crediting Method - Documents

Developing A New Crediting Method. Jeff Hanschmann. Why Develop a New Crediting Method?. Feedback and planned enhancements Options for customers ...
Read more

Language Technologies - CORDIS

Service published by CORDIS, ... The ACCEPT project will address this issue by developing new technologies designed ... new language technologies have ...
Read more

Gabriela Vulcu | LinkedIn

- Developing a methodology ... - Co-managing the technical aspects in the European project Eurosentiment - Developing an RDF ... A User-Centric Service ...
Read more


The EUROSENTIMENT project addresses these issues by 1) developing a common language ... We present a prototype web service that enables researchers to ...
Read more

Gabriela Vulcu | The Insight Centre for Data Analytics

... (EuroSentiment), ... developing a set of algorithms for aggregating functional and non functional properties of ... Gabriela Vulcu, ...
Read more