Skip to content

Hybrid rules

If you need to extract information and categorize based on the same conditions, hybrid rules avoid you to create a double set of very similar rules, saving time and avoiding errors.

A hybrid rule, when triggered, gives point to taxonomy domains and at the same time fills extraction template fields.

To define a hybrid rule, use the plus sign (+) to write a header that combines the header of a categorization rule with that of an extraction rule, then define the condition as for an extraction rule:

SCOPE scopeOption
{
    DOMAIN(domainName) + IDENTIFY(templateName)
    {
        condition
    }
}

For example, considering the text:

This chair was designed using Artificial Intelligence
Celebrated French designer Phillipe Starck has come up with an algorithm for a chair.
AFP RELAXNEWS
Phillipe Starck has teamed up with a longstanding collaborator, Italian furniture company Kartell, to create the first chair to be designed using artificial intelligence, which is aptly named "A.I".
Plastic furniture specialist Kartell embarked on a new direction when it adopted a development process using AI in the company of a long-time collaborator, French designer Philippe Starck. The man behind the ultra-famous "Ghost" chair selected a series of data and an algorithm to create a chair in line with criteria for strength and solidity as well as the designer's aesthetic preferences.

and the extraction template:

TEMPLATE(BRANDS)
{
    @BRAND,
    @PRODUCT
}

this hybrid rule:

SCOPE SENTENCE
{
    DOMAIN(05) + IDENTIFY(BRANDS)
    {
        @BRAND[ANCESTOR(376882)] <> LEMMA("design")
    }
}

is activated by the brands cited in the text—expressed by concepts that, in the Knowledge Graph, "descend" form the ancestor syncon with id 376882—loosely followed by occurrences of the lemma design.
As a consequence of activation, the rule both adds a default amount of points to the score of domain 05 and fills the @BRAND field of the BRANDS template, thus generating an extraction record.

Rule labels, when needed, must be applied to the first portion of the header.

For example:

SCOPE scopeOption
{
    DOMAIN[[ruleLabel]](domainName) + IDENTIFY(templateName)
    {
        condition
    }
}

Or:

SCOPE scopeOption
{
    IDENTIFY[[ruleLabel]](templateName) + DOMAIN(domainName) 
    {
        condition
    }
}