Skip to content

Logical operators

Logical operators allow the programmer to create combinations of operands based on the syntactic or logical role of the operands themselves in the sentence.

The syntax is:

operand1
logicalOperator
operand2

where logicalOperator can be:

Operator Variant Description
&VS &SV The verb and the subject
&VO &OV The verb and the direct object
&SO &OS The subject and the direct object
&SS Two subjects (for the same verb)
&OO Two objects (of the same verb)

Operators are language keywords and must be written in uppercase.
The reciprocal position in the text of matched tokens is irrelevant since the operators match both active and passive sentences (i.e., both grammatical and logical subjects are detected).
The position (left or right) of each letter (S, V, O) inside the operator keyword indicates the position of the corresponding operand in the combination, not in the text. For example, with &SV the subject is matched by the left operands and the verb by the right, but matched tokens can appear in the text in any order; operands must be swapped when using &VS, but the resulting combination would be perfectly equivalent to the former. Therefore the variants can be considered advantageous because the operands can be written in the order preferred by the user.

Consider the following categorization rule:

SCOPE SENTENCE
{
    DOMAIN(dom1:NORMAL)
    {
        TYPE(NOU, NPH)
        &OV
        ANCESTOR(71230,71231)//  71230: take in, seize, arrest, apprehend, cop, collar, nab, slough, nail, sneeze, pick up  71231: catch, capture, get, captive
    }
}

The rule's condition matches any common name or person's name that, in a clause, is the object of a verb (&OV) with a meaning descending from syncon 71230 (to arrest) or syncon 71231 (to capture). This alternative formulation:

SCOPE SENTENCE
{
    DOMAIN(dom1:NORMAL)
    {
        ANCESTOR(71230,71231)//  71230: take in, seize, arrest, apprehend, cop, collar, nab, slough, nail, sneeze, pick up  71231: catch, capture, get, captive
        &VO
        TYPE(NOU, NPH)
    }
}

is perfectly equivalent.

If one of the rules above is run against the following text:

Police arrested the man caught on camera while allegedly burglarizing a home in Rutherford, the Rutherford Police Department announced in a release.
Stenborg was arrested at the Lodi address at about 1 p.m.. Stenborg's clothes matched those in the surveillance footage, police said.
Police recovered the jewelry stolen from the Rutherford home, police said.

it gets triggered two times, the first time by arrested and man in the first sentence and the second by Stemborg and arrested in the second sentence.
The person's name Stenborg is recognized as the subject of the passive voice was arrested. The disambiguator is able to bring the passive voices back to the corresponding active form and thus recognize that the passive subject is indeed the active object.

Info

In the expert.ai programmers' community, logical operators are also known as logical sequences or logical relations.