grammar

grammar#

DisCopy’s grammar modules: thue, cfg, categorial, pregroup and dependency.

discopy.grammar.thue

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

discopy.grammar.cfg

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

discopy.grammar.categorial

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

discopy.grammar.pregroup

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

discopy.grammar.dependency

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