Skip to main content

The Matching Details Parameter

Abstract

The Matching Details Parameter

Let us now expand our previous 'extract' call by adding the parameter 'showMatchingDetails' allowing us to look at the annotation details. We will use the parameter in the following way in the address bar of our web browser:

Request

{{url}}/extractor/api/extract?text=A Spritz Veneziano also called just Spritz or just Veneziano, is an Italian wine-based cocktail, commonly served as an aperitif in northeast Italy. The drink originated in Venice while it was part of the Austrian Empire, and is based on the Austrian Spritzer, a combination of equal parts white wine and soda water.&projectId={{project}}&language=en&numberOfTerms=0&showMatchingDetails=true

This allows us to retrieve information regarding the concept labels that were actually found in the text and what the matched text was.

In our example we are just focusing on the first detected concept appearing twice in the text and matching both 'Spritz Veneziano' and 'Spritz'. In our example the matched text and the labels are the same, and although this may appear to be a bit repetitive there may be cases where the matched text differs from the label, for instance when the label is a singular term and the actual appearance in the text is in its plural form.

Results

{
    "id": "1E034541-9963-0001-EE48-B5D068201D43:https://nextrelease-cons.semantic-web.at/cocktails/2c682ed8-e2ba-473e-8cb7-979598080e18@en",
    "project": "1E034541-9963-0001-EE48-B5D068201D43",
    "score": 100,
    "uri": "https://nextrelease-cons.semantic-web.at/cocktails/2c682ed8-e2ba-473e-8cb7-979598080e18",
    "language": "en",
    "prefLabel": "Spritz Veneziano",
    "altLabels": [
        "Spritz"
    ],
    "conceptSchemes": [
        {
            "uri": "https://nextrelease-cons.semantic-web.at/cocktails/8d052dfc-44bf-4985-8ce3-4564570a161b",
            "title": "Cocktails"
        }
    ],
    "frequencyInDocument": 2,
    "matchingLabels": [
        {
            "label": "Spritz Veneziano",
            "predicate": "prefLabel",
            "frequency": 1,
            "matchedTexts": [
                {
                    "matchedText": "spritz veneziano",
                    "frequency": 1
                }
            ]
        },
        {
            "label": "Spritz",
            "predicate": "altLabel",
            "frequency": 1,
            "matchedTexts": [
                {
                    "matchedText": "spritz",
                    "frequency": 1
                }
            ]
        }
    ]
}

There is another parameter you can use in order to go into even more detail, namely 'showMatchingPosition':

Request

{{url}}/extractor/api/extract?text=A Spritz Veneziano also called just Spritz or just Veneziano, is an Italian wine-based cocktail, commonly served as an aperitif in northeast Italy. The drink originated in Venice while it was part of the Austrian Empire, and is based on the Austrian Spritzer, a combination of equal parts white wine and soda water.&projectId={{project}}&language=en&numberOfTerms=0&showMatchingDetails=true&showMatchingPosition=true

Now the positions in terms of character count in the text are also returned:

Results

{
    "id": "1E034541-9963-0001-EE48-B5D068201D43:https://nextrelease-cons.semantic-web.at/cocktails/2c682ed8-e2ba-473e-8cb7-979598080e18@en",
    "project": "1E034541-9963-0001-EE48-B5D068201D43",
    "score": 100,
    "uri": "https://nextrelease-cons.semantic-web.at/cocktails/2c682ed8-e2ba-473e-8cb7-979598080e18",
    "language": "en",
    "prefLabel": "Spritz Veneziano",
    "altLabels": [
        "Spritz"
    ],
    "conceptSchemes": [
        {
            "uri": "https://nextrelease-cons.semantic-web.at/cocktails/8d052dfc-44bf-4985-8ce3-4564570a161b",
            "title": "Cocktails"
        }
    ],
    "frequencyInDocument": 2,
    "matchingLabels": [
        {
            "label": "Spritz Veneziano",
            "predicate": "prefLabel",
            "frequency": 1,
            "matchedTexts": [
                {
                    "matchedText": "spritz veneziano",
                    "frequency": 1,
                    "positions": [
                        {
                            "beginningIndex": 2,
                            "endIndex": 17
                        }
                    ]
                }
            ]
        },
        {
            "label": "Spritz",
            "predicate": "altLabel",
            "frequency": 1,
            "matchedTexts": [
                {
                    "matchedText": "spritz",
                    "frequency": 1,
                    "positions": [
                        {
                            "beginningIndex": 36,
                            "endIndex": 41
                        }
                    ]
                }
            ]
        }
    ]
}