Eurosentiment - Developing a new service

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

Published on March 3, 2014

Author: mario_munoz

Source: slideshare.net

Description

Tutorial for developing a new service inside Eurosentiment platform.

HOW TO DEVELOP A NEW SERVICE

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 http://54.213.50.118:9000/accounts/ 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: http://140.203.155.231:8890/sparql/{resource_id}, being resource_id a hash (e.g., c1eb1886-b3a1-4435-9284-fa1ecd9a8d55) Service: http://217.26.90.243:8080/EuroSentimentServices/services/server/access/{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 = b.post(ClientResponse.class, req); results = response.getEntity(String.class); } catch (Exception e) { e.printStackTrace(); } return results; } } Note: in the code above we use Jersey APIs: https://jersey.java.net/download.html

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(http://217.26.90.243:8080/EuroSentimentServices/services/server/access/123456, 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": "http://eurosentiment.eu/contexts/basecontext.jsonld", "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(“http://217.26.90.243:8080/EuroSentimentServices/services/server/access/123456", j.toString()); }

Add a comment

Related presentations

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 - documents.mx

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

UROSENTIMENT - dl.acm.org

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