curl-library
Re: [Dbp-spotlight-users] Annotation format
Date: Tue, 20 May 2014 14:55:07 +0200
Thank for your reply David. This is the url I am using
std::string lang_url, text="President Obama called Wednesday on Congress
to extend a tax break for students included in last year's economic
stimulus package, arguing that the policy provides more generous
assistance.";
lang_url="http://spotlight.sztaki.hu:2222/rest/annotate?text=";
data=lang_url+text+"&confidence=0.0&support=0";
It sould be correct I thing.
Regards
Olivier
2014-05-20 13:11 GMT+02:00 David Przybilla <dav.alejandro_at_gmail.com>:
> Hi Olivier,
>
> I'm not aware of how the cpp lib works.
>
> But maybe I would try getting rid of :
>
> - " curl_slist_append( headers, "Content-Type: application/xml");"
>
> As you are not actually sending xml to the server, You are sending plain
> text.
>
> are you sure you are hitting the right endpoint?
> `host:2222/rest/annotate`
>
> and also sending the right params? I don't see any `text` parameter over
> there.
>
>
>
>
> On Tue, May 20, 2014 at 11:21 AM, Olivier Austina <
> olivier.austina_at_gmail.com> wrote:
>
>> Hi David,
>> Thank you for your reply. It seems that the server ignore the header. I
>> am using libcurl in C++. How to rewrite your command in libcurl:
>>
>>
>> curl -G http://spotlight.sztaki.hu:2228/rest/annotate -H "Accept:
>> application/xml" --data-urlencode "text=President Obama called Wednesday on
>> Congress to extend a tax break for students included in last year's
>> economic stimulus package, arguing that the policy provides more generous
>> assistance. Edward Snowden worked for the NSA
>>
>> This is my previous code:
>>
>> CURL *curl;
>> struct curl_slist *headers=NULL; // init to NULL is important
>> curl_slist_append(headers, "Accept: application/xml");
>> curl_slist_append( headers, "Content-Type: application/xml");
>> curl_slist_append( headers, "charsets: utf-8");
>> curl = curl_easy_init();
>> curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
>> curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
>> curl_easy_setopt(curl, CURLOPT_HTTPGET,1);
>> curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
>> curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curl_write);
>> curl_easy_perform(curl);
>> curl_slist_free_all(headers);
>> curl_easy_cleanup(curl);
>>
>>
>> Regards
>> Olivier
>>
>>
>>
>> 2014-05-20 9:36 GMT+02:00 David Przybilla <dav.alejandro_at_gmail.com>:
>>
>> Hi Olivier,
>>>
>>> Doing the following works for me :
>>>
>>> curl -G http://spotlight.sztaki.hu:2228/rest/annotate -H "Accept:
>>> application/xml" --data-urlencode "text=President Obama called Wednesday on
>>> Congress to extend a tax break for students included in last year's
>>> economic stimulus package, arguing that the policy provides more generous
>>> assistance. Edward Snowden worked for the NSA
>>>
>>> Am 20.05.2014 00:53 schrieb "Olivier Austina" <olivier.austina_at_gmail.com
>>> >:
>>> >
>>> > Hi Alex,
>>> > Thank you for your reply. I have tried to put application/xml in the
>>> request header but it does not work for me. This is how the code looks like:
>>> >
>>> > CURL *curl;
>>> > struct curl_slist *headers=NULL; // init to NULL is important
>>> > curl_slist_append(headers, "Accept: application/xml");
>>> > curl_slist_append( headers, "Content-Type: application/xml");
>>> > curl_slist_append( headers, "charsets: utf-8");
>>> > curl = curl_easy_init();
>>> > curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
>>> > curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
>>> > curl_easy_setopt(curl, CURLOPT_HTTPGET,1);
>>> > curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
>>> > curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curl_write);
>>> > curl_easy_perform(curl);
>>> > curl_slist_free_all(headers);
>>> > curl_easy_cleanup(curl);
>>> >
>>> >
>>> > Thank you
>>> >
>>> > Regards
>>> > Olivier
>>> >
>>> >
>>> >
>>> > 2014-05-17 17:29 GMT+02:00 Alex Olieman <alex_at_olieman.net>:
>>> >>
>>> >> Hi Olivier,
>>> >>
>>> >> Sure, you can ask for a response format by setting the corresponding
>>> accept header. E.g. for XML you would include Accept: application/xml or
>>> for JSON Accept: application/json in the request headers.
>>> >>
>>> >> Best,
>>> >> Alex
>>> >>
>>> >> On 17-5-2014 14:38, Olivier Austina wrote:
>>> >>>
>>> >>> Hi
>>> >>> Is there a way to specify the annotation format ( in XML for
>>> example). I am querying the French endpoint as a web service:
>>> >>>
>>> >>> French - http://spotlight.sztaki.hu:2225/rest
>>> >>>
>>> >>> but I got result in format in HTML.
>>> >>>
>>> >>> Thank you.
>>> >>>
>>> >>> Regards
>>> >>> Olivier
>>> >>>
>>> >>>
>>> >>>
>>> >>>
>>> ------------------------------------------------------------------------------
>>> >>> "Accelerate Dev Cycles with Automated Cross-Browser Testing - For
>>> FREE
>>> >>> Instantly run your Selenium tests across 300+ browser/OS combos.
>>> >>> Get unparalleled scalability from the best Selenium testing platform
>>> available
>>> >>> Simple to use. Nothing to install. Get started now for free."
>>> >>> http://p.sf.net/sfu/SauceLabs
>>> >>>
>>> >>>
>>> >>>
>>> >>> _______________________________________________
>>> >>> Dbp-spotlight-users mailing list
>>> >>> Dbp-spotlight-users_at_lists.sourceforge.net
>>> >>> https://lists.sourceforge.net/lists/listinfo/dbp-spotlight-users
>>> >>
>>> >>
>>> >
>>> >
>>> >
>>> ------------------------------------------------------------------------------
>>> > "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
>>> > Instantly run your Selenium tests across 300+ browser/OS combos.
>>> > Get unparalleled scalability from the best Selenium testing platform
>>> available
>>> > Simple to use. Nothing to install. Get started now for free."
>>> > http://p.sf.net/sfu/SauceLabs
>>> > _______________________________________________
>>> > Dbp-spotlight-users mailing list
>>> > Dbp-spotlight-users_at_lists.sourceforge.net
>>> > https://lists.sourceforge.net/lists/listinfo/dbp-spotlight-users
>>> >
>>>
>>
>>
>
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-05-20