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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Cmoore
Frequent Visitor

Azure Cognitive Services connection to Power BI

Hi,

 

I've just been granted access to Cognitive services in my organisation and want to use "Entity Recognition" to extract company entities from a headline text. For example, "text": "Eutelsat Downgraded to B by SP Outlook Stable." would extract Eutelsat as an organisation. I am wanting to connect Power BI to Cognitive services and have produced this bank of code;

 

(text) => let   

apikey      = "xxxxxxxxxxxxxx",    

endpoint    = "https://xxxxxxxxxxxx.cognitiveservices.azure.com/language/:analyze-text?api- version=2023-04-01",    

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),    

doc=jsonresp[documents]{0},    

result=doc[entities]

in #"result"

When trialling the connections I saw that Entity recognition was classified as "kind": "EntityRecognition" in the body. Would you happen to know how I can connect to EntityRecognition language service and amend the code above? 

 

Thanks

Chris

2 REPLIES 2
Anonymous
Not applicable

Hi, @Cmoore 

 

To connect to the EntityRecognition language service, you need to specify the kind parameter in your request body as EntityRecognition. This indicates that you are requesting the EntityRecognition language feature. You can also specify other input parameters, such as the language and the text to be analyzed by the Language service.

 

Perhaps you can use the following modification code to connect to the EntityRecognition language service:

 

(text) => let

    apikey = "xxxxxxxxxxxxxx",

    endpoint = https://xxxxxxxxxxxx.cognitiveservices.azure.com/language/:analyze-text?api-version=2023-04-01,

    jsontext = Text.FromBinary(Json.FromValue(Text.Start(Text.Trim(text), 5000))),

    jsonbody = "{ documents: [ { language: ""en"", id: ""0"", text: " & jsontext & " } ], kind: ""EntityRecognition"" }",

    bytesbody = Text.ToBinary(jsonbody),

    headers = [#"Ocp-Apim-Subscription-Key" = apikey],

    bytesresp = Web.Contents(endpoint, [Headers=headers, Content=bytesbody]),

    jsonresp = Json.Document(bytesresp),

    doc=jsonresp[documents]{0},

    result=doc[entities]

in #"result"

 

The kind parameter in the jsonbody variable is set to EntityRecognition. This might connect Power BI to the EntityRecognition language service and extract the corporate entity from the text provided.

 

How to Get Your Question Answered Quickly 

Best Regards

Yongkang Hua

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you I will take a look. Over the weekend, I came across another end-point that is in use. Do you know the differences between; 

https://xxxxxxxxx.cognitiveservices.azure.com/text/analytics/v2.1/entities and

https://xxxxxxxxx.cognitiveservices.azure.com/text/analytics/v3.1/entities/recognition/general

 

Is there one instance that we should use over another? When I'm looking through the Microsoft documentation I never see any such end points mentioned.

 

Thanks

Chris

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.