nltk.ccg.api module¶
- class nltk.ccg.api.AbstractCCGCategory[source]¶
Bases:
object
Interface for categories in combinatory grammars.
- class nltk.ccg.api.CCGVar[source]¶
Bases:
AbstractCCGCategory
Class representing a variable CCG category. Used for conjunctions (and possibly type-raising, if implemented as a unary rule).
- __init__(prim_only=False)[source]¶
Initialize a variable (selects a new identifier)
- Parameters
prim_only (bool) – a boolean that determines whether the variable is restricted to primitives
- class nltk.ccg.api.Direction[source]¶
Bases:
object
Class representing the direction of a function application. Also contains maintains information as to which combinators may be used with the category.
- class nltk.ccg.api.PrimitiveCategory[source]¶
Bases:
AbstractCCGCategory
Class representing primitive categories. Takes a string representation of the category, and a list of strings specifying the morphological subcategories.
- class nltk.ccg.api.FunctionalCategory[source]¶
Bases:
AbstractCCGCategory
Class that represents a function application category. Consists of argument and result categories, together with an application direction.
- substitute(subs)[source]¶
Takes a set of (var, category) substitutions, and replaces every occurrence of the variable with the corresponding category.