nltk.ccg.lexicon module¶
CCG Lexicons
- 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
- 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)
- nltk.ccg.lexicon.augParseCategory(line, primitives, families, var=None)[source]¶
Parse a string representing a category, and returns a tuple with (possibly) the CCG variable for the category
- nltk.ccg.lexicon.fromstring(lex_str, include_semantics=False)[source]¶
Convert string representation into a lexicon for CCGs.
- 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