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.
A formal grammar is a free monoidal category with words and rules as boxes. |
|
A context free grammar is a formal grammar where the rules all have a codomain of length 1. |
|
A categorial grammar is a free biclosed category with words as boxes. |
|
A pregroup grammar is a free rigid category with words as boxes. |
|
A dependency grammar is both a pregroup and a context-free grammar. |
|
Abstract categorial grammars after de Groote's Towards abstract categorial grammars (2001): a vocabulary generates a free closed category and a |
|
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. |