Determiners

Determiners are words that restrict the noun phrase.

“Examples in English include articles (the and a), demonstratives (this, that), possessives (my, their), and quantifiers (many, both). Not all languages have determiners, and not all systems of grammatical description recognize them as a distinct category.” - Wikipedia

Generalized quantification

Formal logic posits the existential (i.e. at least one) and the universal (i.e. all) quantifiers. Natural language also has numeric quantifiers (like “two”, “most”, “at least five”). Both can be handled by the same technique of generalized quantification. The technique is mainly suitable for quantifiers, but for simplicity it is used here for all determiners.

Generalized quantification is implemented as a SemanticFunction that takes a Range and a Body.

SemanticFunction([Range, Body], <determiner-function>)

Range is bound to an nbar that is the part of the np without the determiner (for example: children). Body is bound to a vp (for example: are playing).

A determiner is always used by an np, as the first parameter in an apply call:

{
    "syn": "np(E1) -> det(E1) nbar(E1)",
    "sem": lambda det, nbar:
            SemanticFunction([Body], apply(det, nbar, Body))
}

The universal quantifier looks like this:

{
    "syn": "det(E1) -> 'all'",
    "sem": lambda:
            SemanticFunction([Range, Body], [('all', E1, Range, Body)])
}

while the existential quantifier looks like this:

{
    "syn": "det(E1) -> 'some'",
    "sem": lambda:
            SemanticFunction([Range, Body], Range + Body)
}

Note that the all-quantifier produces an extra atom, whereas the existential quantifier just returns the input. This is important, because it allows the semantic representation to stay shallow, and thus optimizable.

The quantifier “more than”:

{
    "syn": "det(E1) -> 'more' 'than' number(E1)",
    "sem": lambda number:
            SemanticFunction([Range, Body], [('det_greater_than', Range + Body, number)])
}

In the same vein, there are predicates det_less_than and det_equals.