lambek

lambek#

DisCoPy’s grammar modules.

discopy.lambek.abstract.neural and discopy.lambek.categorial.bobcat need PyTorch, which the lambek extra installs, so they are not imported here: import them on their own.

thue

A formal grammar is a free monoidal category with words and rules as boxes.

cfg

A context free grammar is a formal grammar where the rules all have a codomain of length 1.

categorial

A categorial grammar is a free biclosed category with words as boxes.

pregroup

A pregroup grammar is a free rigid category with words as boxes.

dependency

A dependency grammar is both a pregroup and a context-free grammar.

abstract

Abstract categorial grammars after de Groote's Towards abstract categorial grammars (2001): a vocabulary generates a free closed category and a Lexicon is a functor between two of them, which is all there is to a grammar.

tokenise

The words of English text as the Penn Treebank writes them, which is how CCGbank and CCGrebank write them, so that a parser trained on either, e.g. discopy.lambek.categorial.bobcat.Parser, reads raw text.