Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

calling the entity api from powerbi

hi all,

 

can anyone help

 

i could be wrong but microsoft seem to have made entity detection availble in the ACS. im trying to call it but am getting cannot convert a record into type text!

 

this is the code -  i cant write M, i pinched it from the MS guidance for key phrases and adapted it for entities. I'm invoking the function on a sngle column of unstructured survey responses. i've cleaned it for sentiment analysis, so uneccesary punctuation and non lexical characters are gone

 

// Returns entities from the text in a comma-separated list
(text) => let
    apikey      = " xxxx ",
    endpoint    = "https://uksouth.api.cognitive.microsoft.com/text/analytics/v2.0/entities",
    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),
    entities    = Text.Lower(Text.Combine(jsonresp[documents]{0}[entities], ", "))
in  entities

1 REPLY 1
v-yuta-msft
Community Support
Community Support

Hi cxputcm,

 

Maybe this similar thread case help you: https://community.powerbi.com/t5/Desktop/Expression-Error-We-cannot-convert-a-value-of-type-Record-t....

 

Regards,

Jimmy Tao

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.