Skip to main content

Filtering Nested Concepts

Abstract

Filtering Nested Concepts

Nested concept annotations are occurrences where annotated concepts in a text overlap, meaning that one concept is completely contained within another one.

The following example illustrates this clearly - the concepts are 'shark', 'tiger' and 'tiger shark'. In the sentence 'We went for tiger shark observations' all three concepts would match, however this is avoided by default and only the longest match, here 'tiger shark' is preserved, and the other two are removed.

To see how this works we will enter the following request in the address bar of our web browser:

Request

{{url}}/extractor/api/extract?text=The whiskey sour is a mixed drink containing whiskey (often bourbon), lemon juice, sugar, and optionally, a dash of egg white.&projectId={{project}}&language=en&numberOfTerms=0

This call returns the following:

Results

{
    "concepts": [
        {
            "id": "1E034541-9963-0001-EE48-B5D068201D43:https://nextrelease-cons.semantic-web.at/cocktails/76c0e55c-22df-4489-9551-4fe8a6a649f8@en",
            "project": "1E034541-9963-0001-EE48-B5D068201D43",
            "score": 100,
            "uri": "https://nextrelease-cons.semantic-web.at/cocktails/76c0e55c-22df-4489-9551-4fe8a6a649f8",
            "language": "en",
            "prefLabel": "Whiskey sour",
            "altLabels": [
                "Whiskey sour (cocktail)",
                "Whisky sour",
                "Whiskey Sour (cocktail)",
                "Whisky Sour",
                "Boston sour"
            ],
            "conceptSchemes": [
                {
                    "uri": "https://nextrelease-cons.semantic-web.at/cocktails/8d052dfc-44bf-4985-8ce3-4564570a161b",
                    "title": "Cocktails"
                }
            ],
            "frequencyInDocument": 1
        },
        {
            "id": "1E034541-9963-0001-EE48-B5D068201D43:https://nextrelease-cons.semantic-web.at/cocktails/54702498-ad42-4af6-b28a-2276215450da@en",
            "project": "1E034541-9963-0001-EE48-B5D068201D43",
            "score": 72,
            "uri": "https://nextrelease-cons.semantic-web.at/cocktails/54702498-ad42-4af6-b28a-2276215450da",
            "language": "en",
            "prefLabel": "Mixed drink",
            "altLabels": [
                "Mixed drinks",
                "Mixed Drinks",
                "Sling (drink)"
            ],
            "conceptSchemes": [
                {
                    "uri": "https://nextrelease-cons.semantic-web.at/cocktails/8d052dfc-44bf-4985-8ce3-4564570a161b",
                    "title": "Cocktails"
                }
            ],
            "frequencyInDocument": 1
        },
        {
            "id": "1E034541-9963-0001-EE48-B5D068201D43:https://nextrelease-cons.semantic-web.at/cocktails/c4339109-ae35-4be9-a7e8-b5dfd206e960@en",
            "project": "1E034541-9963-0001-EE48-B5D068201D43",
            "score": 55,
            "uri": "https://nextrelease-cons.semantic-web.at/cocktails/c4339109-ae35-4be9-a7e8-b5dfd206e960",
            "language": "en",
            "prefLabel": "Whisky",
            "altLabels": [
                "Craythur",
                "Whiskies",
                "Uisge beatha",
                "Whiskey",
                "Hot whiskey",
                "Wiskey",
                "Tarantula juice",
                "Usquebaugh",
                "Usquebeathe"
            ],
            "conceptSchemes": [
                {
                    "uri": "https://nextrelease-cons.semantic-web.at/cocktails/591cf89a-57af-49b8-9042-3fc77408c93e",
                    "title": "Beverages"
                }
            ],
            "frequencyInDocument": 1
        },
        {
            "id": "1E034541-9963-0001-EE48-B5D068201D43:https://nextrelease-cons.semantic-web.at/cocktails/3e2d26b8-928b-462d-99ee-59eac11b241f@en",
            "project": "1E034541-9963-0001-EE48-B5D068201D43",
            "score": 45,
            "uri": "https://nextrelease-cons.semantic-web.at/cocktails/3e2d26b8-928b-462d-99ee-59eac11b241f",
            "language": "en",
            "prefLabel": "Bourbon whiskey",
            "altLabels": [
                "Bourbon whisky",
                "Bourbon",
                "Kentucky Whiskey"
            ],
            "conceptSchemes": [
                {
                    "uri": "https://nextrelease-cons.semantic-web.at/cocktails/591cf89a-57af-49b8-9042-3fc77408c93e",
                    "title": "Beverages"
                }
            ],
            "frequencyInDocument": 1
        },
        {
            "id": "1E034541-9963-0001-EE48-B5D068201D43:https://nextrelease-cons.semantic-web.at/cocktails/9c2ce399-c6ae-4f4d-bf37-7fd8ffe2a19d@en",
            "project": "1E034541-9963-0001-EE48-B5D068201D43",
            "score": 40,
            "uri": "https://nextrelease-cons.semantic-web.at/cocktails/9c2ce399-c6ae-4f4d-bf37-7fd8ffe2a19d",
            "language": "en",
            "prefLabel": "Lemon juice",
            "conceptSchemes": [
                {
                    "uri": "https://nextrelease-cons.semantic-web.at/cocktails/591cf89a-57af-49b8-9042-3fc77408c93e",
                    "title": "Beverages"
                }
            ],
            "frequencyInDocument": 1
        },
        {
            "id": "1E034541-9963-0001-EE48-B5D068201D43:https://nextrelease-cons.semantic-web.at/cocktails/3c94f5fc-4664-4177-a880-88643c0be9c1@en",
            "project": "1E034541-9963-0001-EE48-B5D068201D43",
            "score": 31,
            "uri": "https://nextrelease-cons.semantic-web.at/cocktails/3c94f5fc-4664-4177-a880-88643c0be9c1",
            "language": "en",
            "prefLabel": "Sugar",
            "altLabels": [
                "Sugary",
                "-Ose",
                "Shurger",
                "Sugar crops",
                "Cube sugar",
                "Foreign matter in refined sugar",
                "Sugar lumps",
                "Molten sugar",
                "Berry sugar",
                "Refined sugar",
                "White refined sugar",
                "Sugar Crystals",
                "Sugar trade",
                "Suggar",
                "Sweet salt",
                "Lump sugar",
                "Raw Sugar",
                "Sugar buzz",
                "Sugar cube",
                "White sugar",
                "Sugar engineering",
                "Sugars",
                "White Sugar"
            ],
            "conceptSchemes": [
                {
                    "uri": "https://nextrelease-cons.semantic-web.at/cocktails/87384ce8-f20a-4201-b06d-3e0b8d832e5d",
                    "title": "Sweeteners"
                }
            ],
            "frequencyInDocument": 1
        },
        {
            "id": "1E034541-9963-0001-EE48-B5D068201D43:https://nextrelease-cons.semantic-web.at/cocktails/98f20476-57d7-46d3-b76d-6aac18b57788@en",
            "project": "1E034541-9963-0001-EE48-B5D068201D43",
            "score": 12,
            "uri": "https://nextrelease-cons.semantic-web.at/cocktails/98f20476-57d7-46d3-b76d-6aac18b57788",
            "language": "en",
            "prefLabel": "Egg white",
            "altLabels": [
                "Glairy",
                "Albumen",
                "Egg whites",
                "Egg-white",
                "Ovoglobulin G2",
                "Eggwhite",
                "Egg albumin",
                "White of an egg",
                "Glair",
                "Egg albumen"
            ],
            "conceptSchemes": [
                {
                    "uri": "https://nextrelease-cons.semantic-web.at/cocktails/591cf89a-57af-49b8-9042-3fc77408c93e",
                    "title": "Beverages"
                }
            ],
            "frequencyInDocument": 1
        }
    ]
}

Sometimes however you may want to have all matches, including those which are nested; then you only need to set the parameter 'filterNestedConcepts' to 'false' (default setting is 'true').

To illustrate this enter the following request into your browser's address bar:

Request

{{url}}/extractor/api/extract?text=The whiskey sour is a mixed drink containing whiskey (often bourbon), lemon juice, sugar, and optionally, a dash of egg white.&projectId={{project}}&language=en&numberOfTerms=0&filterNestedConcepts=false

These results differ from the first call using the default settings of the parameter 'filterNestedConcepts'; now 'Whisky' appears twice (before it appeared once) and additional concepts 'Sour', 'Drink', 'Juice', and 'Lemon' have been detected which did not show up after the first call. The results returned by the second call are:

Results

{
    "concepts": [
        {
            "id": "1E034541-9963-0001-EE48-B5D068201D43:https://nextrelease-cons.semantic-web.at/cocktails/c4339109-ae35-4be9-a7e8-b5dfd206e960@en",
            "project": "1E034541-9963-0001-EE48-B5D068201D43",
            "score": 100,
            "uri": "https://nextrelease-cons.semantic-web.at/cocktails/c4339109-ae35-4be9-a7e8-b5dfd206e960",
            "language": "en",
            "prefLabel": "Whisky",
            "altLabels": [
                "Craythur",
                "Whiskies",
                "Uisge beatha",
                "Whiskey",
                "Hot whiskey",
                "Wiskey",
                "Tarantula juice",
                "Usquebaugh",
                "Usquebeathe"
            ],
            "conceptSchemes": [
                {
                    "uri": "https://nextrelease-cons.semantic-web.at/cocktails/591cf89a-57af-49b8-9042-3fc77408c93e",
                    "title": "Beverages"
                }
            ],
            "frequencyInDocument": 2
        },
        {
            "id": "1E034541-9963-0001-EE48-B5D068201D43:https://nextrelease-cons.semantic-web.at/cocktails/76c0e55c-22df-4489-9551-4fe8a6a649f8@en",
            "project": "1E034541-9963-0001-EE48-B5D068201D43",
            "score": 64,
            "uri": "https://nextrelease-cons.semantic-web.at/cocktails/76c0e55c-22df-4489-9551-4fe8a6a649f8",
            "language": "en",
            "prefLabel": "Whiskey sour",
            "altLabels": [
                "Whiskey sour (cocktail)",
                "Whisky sour",
                "Whiskey Sour (cocktail)",
                "Whisky Sour",
                "Boston sour"
            ],
            "conceptSchemes": [
                {
                    "uri": "https://nextrelease-cons.semantic-web.at/cocktails/8d052dfc-44bf-4985-8ce3-4564570a161b",
                    "title": "Cocktails"
                }
            ],
            "frequencyInDocument": 1
        },
        {
            "id": "1E034541-9963-0001-EE48-B5D068201D43:https://nextrelease-cons.semantic-web.at/cocktails/7516b400-963a-4151-8fdc-f6b23bad1dd5@en",
            "project": "1E034541-9963-0001-EE48-B5D068201D43",
            "score": 60,
            "uri": "https://nextrelease-cons.semantic-web.at/cocktails/7516b400-963a-4151-8fdc-f6b23bad1dd5",
            "language": "en",
            "prefLabel": "Sour",
            "altLabels": [
                "Sour Cocktail"
            ],
            "conceptSchemes": [
                {
                    "uri": "https://nextrelease-cons.semantic-web.at/cocktails/8d052dfc-44bf-4985-8ce3-4564570a161b",
                    "title": "Cocktails"
                }
            ],
            "frequencyInDocument": 1
        },
        {
            "id": "1E034541-9963-0001-EE48-B5D068201D43:https://nextrelease-cons.semantic-web.at/cocktails/54702498-ad42-4af6-b28a-2276215450da@en",
            "project": "1E034541-9963-0001-EE48-B5D068201D43",
            "score": 47,
            "uri": "https://nextrelease-cons.semantic-web.at/cocktails/54702498-ad42-4af6-b28a-2276215450da",
            "language": "en",
            "prefLabel": "Mixed drink",
            "altLabels": [
                "Mixed drinks",
                "Mixed Drinks",
                "Sling (drink)"
            ],
            "conceptSchemes": [
                {
                    "uri": "https://nextrelease-cons.semantic-web.at/cocktails/8d052dfc-44bf-4985-8ce3-4564570a161b",
                    "title": "Cocktails"
                }
            ],
            "frequencyInDocument": 1
        },
        {
            "id": "1E034541-9963-0001-EE48-B5D068201D43:https://nextrelease-cons.semantic-web.at/cocktails/75b586dd-6bd9-4894-a258-90007061c029@en",
            "project": "1E034541-9963-0001-EE48-B5D068201D43",
            "score": 43,
            "uri": "https://nextrelease-cons.semantic-web.at/cocktails/75b586dd-6bd9-4894-a258-90007061c029",
            "language": "en",
            "prefLabel": "Drink",
            "conceptSchemes": [
                {
                    "uri": "https://nextrelease-cons.semantic-web.at/cocktails/591cf89a-57af-49b8-9042-3fc77408c93e",
                    "title": "Beverages"
                }
            ],
            "frequencyInDocument": 1
        },
        {
            "id": "1E034541-9963-0001-EE48-B5D068201D43:https://nextrelease-cons.semantic-web.at/cocktails/3e2d26b8-928b-462d-99ee-59eac11b241f@en",
            "project": "1E034541-9963-0001-EE48-B5D068201D43",
            "score": 29,
            "uri": "https://nextrelease-cons.semantic-web.at/cocktails/3e2d26b8-928b-462d-99ee-59eac11b241f",
            "language": "en",
            "prefLabel": "Bourbon whiskey",
            "altLabels": [
                "Bourbon whisky",
                "Bourbon",
                "Kentucky Whiskey"
            ],
            "conceptSchemes": [
                {
                    "uri": "https://nextrelease-cons.semantic-web.at/cocktails/591cf89a-57af-49b8-9042-3fc77408c93e",
                    "title": "Beverages"
                }
            ],
            "frequencyInDocument": 1
        },
        {
            "id": "1E034541-9963-0001-EE48-B5D068201D43:https://nextrelease-cons.semantic-web.at/cocktails/9c2ce399-c6ae-4f4d-bf37-7fd8ffe2a19d@en",
            "project": "1E034541-9963-0001-EE48-B5D068201D43",
            "score": 26,
            "uri": "https://nextrelease-cons.semantic-web.at/cocktails/9c2ce399-c6ae-4f4d-bf37-7fd8ffe2a19d",
            "language": "en",
            "prefLabel": "Lemon juice",
            "conceptSchemes": [
                {
                    "uri": "https://nextrelease-cons.semantic-web.at/cocktails/591cf89a-57af-49b8-9042-3fc77408c93e",
                    "title": "Beverages"
                }
            ],
            "frequencyInDocument": 1
        },
        {
            "id": "1E034541-9963-0001-EE48-B5D068201D43:https://nextrelease-cons.semantic-web.at/cocktails/33df103a-03ac-4177-b620-7953fe094236@en",
            "project": "1E034541-9963-0001-EE48-B5D068201D43",
            "score": 26,
            "uri": "https://nextrelease-cons.semantic-web.at/cocktails/33df103a-03ac-4177-b620-7953fe094236",
            "language": "en",
            "prefLabel": "Lemon",
            "altLabels": [
                "Lemon extract",
                "Citrus limon",
                "Lemon oil",
                "Lemons",
                "Citrus × limon",
                "Lemon (fruit)",
                "Citrus x limon",
                "Nimbu"
            ],
            "conceptSchemes": [
                {
                    "uri": "https://nextrelease-cons.semantic-web.at/cocktails/eff672ac-6601-42c6-a3e9-0adda3b45df8",
                    "title": "Garnish and other ingredients"
                }
            ],
            "frequencyInDocument": 1
        },
        {
            "id": "1E034541-9963-0001-EE48-B5D068201D43:https://nextrelease-cons.semantic-web.at/cocktails/6c0607a9-410d-4b65-87a1-b189a8e36352@en",
            "project": "1E034541-9963-0001-EE48-B5D068201D43",
            "score": 23,
            "uri": "https://nextrelease-cons.semantic-web.at/cocktails/6c0607a9-410d-4b65-87a1-b189a8e36352",
            "language": "en",
            "prefLabel": "Juice",
            "altLabels": [
                "Fruitextract",
                "Fruit extract",
                "Juices",
                "Bottled juice",
                "Juicebar",
                "Fruit juice",
                "Juice bar",
                "Fruit drink",
                "Fruit juices"
            ],
            "conceptSchemes": [
                {
                    "uri": "https://nextrelease-cons.semantic-web.at/cocktails/591cf89a-57af-49b8-9042-3fc77408c93e",
                    "title": "Beverages"
                }
            ],
            "frequencyInDocument": 1
        },
        {
            "id": "1E034541-9963-0001-EE48-B5D068201D43:https://nextrelease-cons.semantic-web.at/cocktails/3c94f5fc-4664-4177-a880-88643c0be9c1@en",
            "project": "1E034541-9963-0001-EE48-B5D068201D43",
            "score": 20,
            "uri": "https://nextrelease-cons.semantic-web.at/cocktails/3c94f5fc-4664-4177-a880-88643c0be9c1",
            "language": "en",
            "prefLabel": "Sugar",
            "altLabels": [
                "Sugary",
                "-Ose",
                "Shurger",
                "Sugar crops",
                "Cube sugar",
                "Foreign matter in refined sugar",
                "Sugar lumps",
                "Molten sugar",
                "Berry sugar",
                "Refined sugar",
                "White refined sugar",
                "Sugar Crystals",
                "Sugar trade",
                "Suggar",
                "Sweet salt",
                "Lump sugar",
                "Raw Sugar",
                "Sugar buzz",
                "Sugar cube",
                "White sugar",
                "Sugar engineering",
                "Sugars",
                "White Sugar"
            ],
            "conceptSchemes": [
                {
                    "uri": "https://nextrelease-cons.semantic-web.at/cocktails/87384ce8-f20a-4201-b06d-3e0b8d832e5d",
                    "title": "Sweeteners"
                }
            ],
            "frequencyInDocument": 1
        },
        {
            "id": "1E034541-9963-0001-EE48-B5D068201D43:https://nextrelease-cons.semantic-web.at/cocktails/98f20476-57d7-46d3-b76d-6aac18b57788@en",
            "project": "1E034541-9963-0001-EE48-B5D068201D43",
            "score": 8,
            "uri": "https://nextrelease-cons.semantic-web.at/cocktails/98f20476-57d7-46d3-b76d-6aac18b57788",
            "language": "en",
            "prefLabel": "Egg white",
            "altLabels": [
                "Glairy",
                "Albumen",
                "Egg whites",
                "Egg-white",
                "Ovoglobulin G2",
                "Eggwhite",
                "Egg albumin",
                "White of an egg",
                "Glair",
                "Egg albumen"
            ],
            "conceptSchemes": [
                {
                    "uri": "https://nextrelease-cons.semantic-web.at/cocktails/591cf89a-57af-49b8-9042-3fc77408c93e",
                    "title": "Beverages"
                }
            ],
            "frequencyInDocument": 1
        }
    ]
}