Skip to content

Latest commit

 

History

History
152 lines (132 loc) · 3.79 KB

File metadata and controls

152 lines (132 loc) · 3.79 KB
page_type languages products name description azureDeploy
sample
csharp
azure
azure-search
Acronym Linker sample skills for cognitive search
These two custom skills (link-acronyms and link-acronyms-list) give definitions for known acronyms.

Acronym Linker

These two custom skills (link-acronyms and link-acronyms-list) give definitions for known acronyms.

Deploy to Azure

Requirements

These skills have no additional requirements than the ones described in the root README.md file.

Settings

This function uses a JSON file called acronyms.json that can be found at the root of this project, and that will be deployed with the function. This file contains a simple dictionary of acronyms to definitions. We provided a sample file with this project that contains definitions for common computer-related acronyms. Please replace this file with your own data, or point LinkAcronyms to your data.

link-acronyms

Sample Input:

{
    "values": [
        {
            "recordId": "foobar2",
            "data":
            {
                "word": "MS"
            }
        },
        {
            "recordId": "foo1",
            "data":
            {
                "word": "SSL"
            }
        }
    ]
}

Sample Output:

{
    "values": [
        {
            "recordId": "foobar2",
            "data": {
                "acronym": {
                    "value": "MS",
                    "description": "Microsoft"
                }
            },
            "errors": [],
            "warnings": []
        },
        {
            "recordId": "foo1",
            "data": {
                "acronym": {
                    "value": "SSL",
                    "description": "Secure Socket Layer"
                }
            },
            "errors": [],
            "warnings": []
        }
    ]
}

link-acronyms-list

Sample Input:

{
    "values": [
        {
            "recordId": "foobar2",
            "data":
            {
                "words": [ "MS",  "SSL" ]
            }
        }
    ]
}

Sample Output:

{
    "values": [
        {
            "recordId": "foobar2",
            "data": {
                "acronyms": [
                    {
                        "value": "MS",
                        "description": "Microsoft"
                    },
                    {
                        "value": "SSL",
                        "description": "Secure Socket Layer"
                    }
                ]
            },
            "errors": [],
            "warnings": []
        }
    ]
}

Sample Skillset Integration

In order to use this skill in a cognitive search pipeline, you'll need to add a skill definition to your skillset. Here's a sample skill definition for this example (inputs and outputs should be updated to reflect your particular scenario and skillset environment):

{
    "@odata.type": "#Microsoft.Skills.Custom.WebApiSkill",
    "description": "Acronym linker",
    "uri": "[AzureFunctionEndpointUrl]/api/link-acronyms-list?code=[AzureFunctionDefaultHostKey]",
    "batchSize": 1,
    "context": "/document/normalized_images/*/layoutText",
    "inputs": [
        {
            "name": "words",
            "source": "/document/normalized_images/*/layoutText/words/*/text"
        }
    ],
    "outputs": [
        {
            "name": "acronyms",
            "targetName": "acronyms"
        }
    ]
}