nltk.ccg.lexicon module¶
CCG Lexicons
- class nltk.ccg.lexicon.Token[source]¶
Bases:
object
Class representing a token.
token => category {semantics} e.g. eat => Svar[pl]/var {x y.eat(x,y)}
token (string)
categ (string)
semantics (Expression)
- class nltk.ccg.lexicon.CCGLexicon[source]¶
Bases:
object
Class representing a lexicon for CCG grammars.
primitives: The list of primitive categories for the lexicon
families: Families of categories
entries: A mapping of words to possible categories
- nltk.ccg.lexicon.matchBrackets(string)[source]¶
Separate the contents matching the first set of brackets from the rest of the input.
- nltk.ccg.lexicon.nextCategory(string)[source]¶
Separate the string for the next portion of the category from the rest of the string
- nltk.ccg.lexicon.parsePrimitiveCategory(chunks, primitives, families, var)[source]¶
Parse a primitive category
If the primitive is the special category ‘var’, replace it with the correct CCGVar.