The COLLOCATION  operator replaces a string of words with a symbol (or multiple symbols). The operator can be used to directly match words, their parents, or any mixture. As an example

COLLOCATION(PreciseDate, {DayNumber, MonthName, YearNumber})

Cardinal numbers in the range 1..31 are also members of DayNumber. The effect of this COLLOCATION would be to convert the three words in the parse chain

15 June 2007

to the single symbol PreciseDate in the parse chain before parsing commences, simplifying the process.

PreciseDate is a member of TimeNoun, and the particular invocation of the symbol has the attribute value 15 June 2007. A map associated with the collocation calculates the day number and makes it an attribute of the object.

COLLOCATION searches for the parents of each word in the list parameter before checking for a match, so June matches MonthName.

NOCONNECT can be used on words or symbols, allowing checking of context before the collocation match succeeds, as

COLLOCATION(As_Long_As, {NOCONNECT(BeginSentence), As, Long, As})

Strings of words can be cut out as superfluous using the form

COLLOCATION(NullSymbol,{At, Any, Time})

where all trace of the matched word string is removed. Similarly, words can be turned into other words, as

COLLOCATION(If, {In, The, Event, That})

Collocations can also be used to convert multiple symbols into other symbols, as

COLLOCATION({Location, Of}, {NOCONNECT(BeginSentence),Where, ask("is")})

This will convert a "where is" at the start of an interrogative sentence to "location of", and parsing will proceed on the separate symbols of "location" and "of", turning it into a prepositional (it is often easier to change symbols into other symbols where the mechanism already exists to handle them).

Unconditional collocations are handled in the dictionary - "terms and conditions" for example.

Related Operators