我正在尝试使用Power BI和Microsoft认知文本分析进行情感分析。
这是我用于查询的代码。
(Source as table) as any =>
let
JsonRecords = Text.FromBinary(Json.FromValue(Source)),
JsonRequest = "{""documents"": " & JsonRecords & "}",
JsonContent = Text.ToBinary(JsonRequest, TextEncoding.Ascii),
Response =
Web.Contents("https://westcentralus.api.cognitive.microsoft.com/text/analytics/v2.0",
[
Headers = [#"Ocp-Apim-Subscription-Key"= APIKey,
#"Content-Type"="application/json", Accept="application/json"],
Content=JsonContent
]),
JsonResponse = Json.Document(Response,1252)
in
JsonResponse
就我而言,我确实正确创建了参数。我还仔细检查了我的密钥和API。
我收到此错误:
“”查询中发生错误。 DataSource.Error:Web.Contents 无法从中获取内容 'https://westcentralus.api.cognitive.microsoft.com/text/analytics/v2.0' (404):找不到资源详细信息: DataSourceKind = Web DataSourcePath = https://westcentralus.api.cognitive.microsoft.com/text/analytics/v2.0 Url = https://westcentralus.api.cognitive.microsoft.com/text/analytics/v2.0
答案 0 :(得分:0)
此documentation表示POST
请求是针对/sentiment
端点的,因此您应将URL更新为https://westcentralus.api.cognitive.microsoft.com/text/analytics/v2.0/sentiment
。