Forum Discussion
Error in Azure Sentiment Analysis
- 5 years ago
amitchandak just wanted to give you an update, I've finally managed to get the sentiment analysis to work!!
I created parameters for the code so it ended up looking like this:
(text) => let
apikey = APIKey,
endpoint = Endpoint& "/text/analytics/v3.0/"&Service,
jsontext = Text.FromBinary(Json.FromValue(Text.Start(Text.Trim(text), 5000))),
jsonbody = "{ documents: [ { language: ""en"", id: ""0"", text: " & jsontext & " } ] }",
bytesbody = Text.ToBinary(jsonbody),
headers = [#"Ocp-Apim-Subscription-Key" = apikey],
bytesresp = Web.Contents(endpoint, [Headers=headers, Content=bytesbody]),
jsonresp = Json.Document(bytesresp)
in jsonrespI also had a parameter for language replacing the ""en"" but this didn't work so reverted but to the orginal
I'm so happy it worked in the end!!
amitchandak just wanted to give you an update, I've finally managed to get the sentiment analysis to work!!
I created parameters for the code so it ended up looking like this:
(text) => let
apikey = APIKey,
endpoint = Endpoint& "/text/analytics/v3.0/"&Service,
jsontext = Text.FromBinary(Json.FromValue(Text.Start(Text.Trim(text), 5000))),
jsonbody = "{ documents: [ { language: ""en"", id: ""0"", text: " & jsontext & " } ] }",
bytesbody = Text.ToBinary(jsonbody),
headers = [#"Ocp-Apim-Subscription-Key" = apikey],
bytesresp = Web.Contents(endpoint, [Headers=headers, Content=bytesbody]),
jsonresp = Json.Document(bytesresp)
in jsonresp
I also had a parameter for language replacing the ""en"" but this didn't work so reverted but to the orginal
I'm so happy it worked in the end!!