Sentiment Analysis

FREEMIUM
Verified
By Twinword API | Updated месяц назад | Text Analysis
Popularity

9.6 / 10

Latency

215ms

Service Level

100%

Health Check

N/A

Back to All Discussions

Post method not returning anything

Rapid account: Cmorisetty
cmorisetty
9 лет назад

Hi,
I have been trying different ways since yesterday, however when I try using Post method, I get
415: Does not look like a valid request. Here is my ‘post’ code:

unirest_net.http.HttpResponse<Result> response = unirest_net.http.Unirest.post(“https://twinword-sentiment-analysis.p.mashape.com/analyze/”)
.header(“X-Mashape-Key”, “oev6EgT2NSmshKCHKz7RySOn7yzHp1U6MI6jsn23bqI3pUSjqQ”)
.header(“Content-Type”, “application/x-www-form-urlencoded”)
.header(“Accept”, “application/json”)
.field(“text”, “great value in its price range!”)
.asJson<Result>();

But when I use a Get request it returns a result.

My code for Get is
unirest_net.http.HttpResponse<Result> response = unirest_net.http.Unirest.get("https://twinword-sentiment-analysis.p.mashape.com/analyze/?text=great+value+in+its+price+range!")
.header(“X-Mashape-Key”, “oev6EgT2NSmshKCHKz7RySOn7yzHp1U6MI6jsn23bqI3pUSjqQ”)
.header(“Accept”, “application/json”)
.asJson<Result>();

I have been struggling to figure what is going wrong in my API call. All I have done is using the code from Mashape. Could you please assist me.

Rapid account: Cmorisetty
cmorisetty Commented 9 лет назад

Thank you

Rapid account: Twinword
twinword Commented 9 лет назад

Hi cmorisetty,

I’m sorry because our team must have overlooked your last comment.

<strong>SCORE</strong>

Score indicates how negative or positive the overall text analyzed is. Anything below a score of -0.05 we tag as negative and anything above 0.05 we tag as positive. Since we have provided the score, you are free to interpret it yourself.

<strong>RATIO</strong>

The ratio ranges from -1 to 1. It is the ration of total negative scores to total positive scores. Take the below for example.

Let’s say we are analyzing words A, B, C and D.

<strong>Scenario 1)</strong> If words A and B are negative words having a combined total score of -5.0 and words C and D are positive words having a combined total score of 5.0, then the ratio would be 0 (or 1:1) as both sides are balanced.

<strong>Scenario 2)</strong> If negative words have a total combined score of -5.0 while positive words have a total combined score of 2.5, then the ratio would be -0.667 (or 2:1).

<strong>Scenario 3)</strong> If negative words total -5.0 and positive words total 0.0, then the ratio would be -1 (or 1:0) like you do above.

I hope this clarifies things. Again, I apologize that we overlooked your last comment.

Good luck!

[Edited: Corrected ratio in scenario 2]

Rapid account: Cmorisetty
cmorisetty Commented 9 лет назад

HI,

Could you please help me with interpretation of the results returned by the API.

How exactly can the Score and Ratio be interpreted.

For eg: It’s not important

{
“type”: “negative”,
“score”: -0.794201701,
“ratio”: -1,
“keywords”: [
{
“word”: “important”,
“score”: -0.963403402
},
{
“word”: “not”,
“score”: -0.625
}
],
“version”: “4.0.0”,
“author”: “twinword inc.”,
“email”: "feedback@twinword.com",
“result_code”: “200”,
“result_msg”: “Success”
}

For eg: It’s important
{
“type”: “positive”,
“score”: 0.963403402,
“ratio”: 1,
“keywords”: [
{
“word”: “important”,
“score”: 0.963403402
}
],
“version”: “4.0.0”,
“author”: “twinword inc.”,
“email”: "feedback@twinword.com",
“result_code”: “200”,
“result_msg”: “Success”
}

Rapid account: Twinword
twinword Commented 9 лет назад

Thanks for the update, cmorisetty! Please feel free to contact us if you need anything else.

As always, thank you for using our API!

Rapid account: Cmorisetty
cmorisetty Commented 9 лет назад

Thank you very much for getting back to me. I was using UNirest api using C# .net from NUget. When I use the Javascript and connect to your POST APIs they are working fine. Must be an issue with the Nuget package.

Rapid account: Twinword
twinword Commented 9 лет назад

Hi cmorisetty,

Our team looked into everything on our end and we could not find any problems.

The error code you encountered is only returned when our servers do not receive a “text” parameter via POST or GET. This leads me to believe it is an issue with the Unirest plugin or an environment setting that may be blocking POST requests.

To isolate the issue more, could you make sure you are using the latest versions of Unirest (http://unirest.io/java.html) and Java.

If you need further assistance, I suggest contacting Mashape directly (they are the ones who created Unirest). Here is the chat room for Mashpae’s Unirest Java (https://gitter.im/Mashape/unirest-java) or you can email Mashape directly (support@mashape.com) and let them know you have a Unirest POST issue.

Good luck!

In the meantime, I hope you can simply use the GET method as I mentioned above.

Please feel free to contact us again. We look forward to your feedback.

Rapid account: Twinword
twinword Commented 9 лет назад

Hi cmorisetty, I’m sorry you are having trouble.

I have tested the endpoint using the POST method and everything looks fine. Our team will look further into this issue and get back to you as soon as possible.

In the meantime, is it possible for you to pass parameters using the GET method? If you are concerned about security, rest assured that your parameters are encrypted. Over HTTP, GET parameters are visible and part of the URL and even logged in server logs, however, we are using HTTPS, a secure connection over SSL. In our case, a secure connection is first established and then the GET parameters are sent over the encrypted SSL connection. Completely encrypted.

Nonetheless, our team will look into your issue and we’ll get back to you ASAP.

Thanks for using our API!

Join in the discussion - add comment below:

Login / Signup to post new comments