Header image by https://unsplash.com/@v2osk

Extract named entities using Azure Cognitive Services

This year I helped to build drugplug as part of Hack Zurich. One key feature of the app is the extraction of relevant information or warnings out of a drug leaflet. We used Azure Cognitive Services in combination with fuse.js (for fuzzy search) for this purpose.

Integrating Text Analytics into our “data pipeline” was super easy. The following code will extract the named entities and store them as an array.

const entityResults = await client.recognizeEntities( [text] );
for (let document of entityResults) {
if (document.entities) {
processedEntities = {}
for (let entity of document.entities) {
if (!drug[element.key]) {
drug[element.key] = [];
}
var tag = {};
tag.name = entity.text;
tag.category = entity.category;
drug[element.key].push(tag);
}
}
};

We then displayed those entities within our Single Page Application:

The complete code is available on github.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Aymen Furter

Aymen Furter

DevOps – Linux — Kubernetes –Azure — Java — JS — Apache Camel