CrossSection

From OpenCog

A CrossSection is a special case of the Section Link type. It provides a way of elevating one of the Connectors in a Section to being a "germ". It's primary utility is for computing the similarity of two germs.

Example

Consider a Section that describes the phrase "level playing field". It can be represented as

    Section
        Lexical "playing"
        ConnectorSeq
            Connector
                Lexical "level"
                ConnectorDir "-"
            Connector
                Lexical "field"
                ConnectorDir "+"

The above encodes the phrase "level playing field", indicating that "playing" connects to "level" on the left, and to "field" on the right. In this example, "playing" is the germ; it is at the center of the section.

The CrossSection reorganizes a Section so that one of the Connectors is now in the center. For the above example, there are two CrossSections, one for each Connector. The CrossSection for "level" is:

    CrossSection
        LexicalNode "level"
        ShapeLink
            LexicalNode "playing"
            Connector
                AnyNode "$wildcard"
                ConnectorDir "-"
            Connector
                Lexical "field"
                ConnectorDir "+"

The original germ "playing" is now the head of the shape. The word "level" becomes the germ of the CrossSection. The wild-card indicates which slot the the germ of the CrossSection came from. Thus, the original Section can be obtained from the CrossSection by reinserting the new germ into the wild-card.

Utility

The primary usefulness of the CrossSection is in computing the similarity of two germs.Given a germ, one can consider all of the Sections it participates in. These Sections can be thought of as the basis elements of a vector attached to that germ. (Each section can record a number; that set of numbers can be thought of as a vector, with the individual ConnectorSeq's being the basis elements of that vector.) Given two vectors, there are many similarity metrics and distances that can be used to see how similar they are (Hamming distance, Jacquard distance, dot-product, mutual information, etc.).

Although simply using all Sections to form a vector gives an adequate representation of a germ, it appears that the vectors obtained by taking all Sections, together with the CrossSections that can be derived from them, gives a "more accurate" representation.