cat2ty#
- discopy.grammar.categorial.cat2ty(string)[source]#
Translate the string representation of a CCG category into DisCoPy.
A category is either an atom, a bracketed category or two categories around a slash, which associates to the left as in Steedman’s The Syntactic Process (2000). The features that CCGbank writes in square brackets, e.g. the
[dcl]ofS[dcl], are ignored: they refine an atom rather than change it.- Parameters:
string (str) – The string with slashes representing a CCG category.
- Return type:
Ty
Example
>>> print(cat2ty(r"(S[dcl]\NP)/NP")) ((NP >> S) << NP) >>> assert cat2ty(r"S\NP/NP") == cat2ty(r"(S\NP)/NP") >>> assert cat2ty(r"(S\NP)\(S\NP)[conj]") == cat2ty(r"(S\NP)\(S\NP)")