Combinatorial Categorical Grammar (CCG)
Documentation
class Symantics repr whereSource
This class defines the syntax of our fragment (the grammar,
essentially). Its instances will show interpretations
of the grammar, or semantics
show the inferred types, as well as the inferred types for phrases like
The first sample sentence, or CCG derivation The inferred type is S. So, sen1 is a derivations of a complete sentence.
We now define the first interpretation of a CCG derivations: We interpret the derivation to give the parsed string. That is, we generate a yield of a CCG derivation, in English.
We represent each node in the derivation tree by an English phrase
type family Tr synt :: *Source
Show the English form of sen1
We now define semantics of a phrase represented by a derivation. It is a different interpretation of the phrase and its types.
We first interpret syntactic types (NP, slashes, etc) in terms of the types of the language of logic formulas. The type class Lambda defines the language of logic formulas (STT, or higher-order logic) with types Entity, Bool, and the arrows.
We can now see the semantics of sen1
Computing the yield in Japanese
The type family TJ defines the types of sentential forms corresponding to syntactic categories.
We represent each node in the derivation tree by a Japanese phrase or a Japanese sentential form (that is, a phrase with holes). Contrast with the EN interpreter above.
type QNP = S :/ (NP :\\ S)Source
The translation is certainly different: like corresponds to an adjective in Japanese.
Adding quantification; one way
class Symantics repr => Quantifier repr whereSource
We extend our earlier fragment with quantifiers everyone, someone We also add a combinator for raising the first argument of a TV
Quantifier JA | Japanese is challenging: like semantics The expression for quantifiers ensures that no inverse reading is possible. Only linear reading. |
Quantifier EN | But how to put a quantifier in an object position? |
Lambda lrepr => Quantifier (Sem lrepr) |