nltk.grammar.DependencyProduction

class nltk.grammar.DependencyProduction[source]

Bases: Production

A dependency grammar production. Each production maps a single head word to an unordered list of one or more modifier words.

__init__(lhs, rhs)

Construct a new Production.

Parameters
  • lhs (Nonterminal) – The left-hand side of the new Production.

  • rhs (sequence(Nonterminal and terminal)) – The right-hand side of the new Production.

is_lexical()

Return True if the right-hand contain at least one terminal token.

Return type

bool

is_nonlexical()

Return True if the right-hand side only contains Nonterminals

Return type

bool

lhs()

Return the left-hand side of this Production.

Return type

Nonterminal

rhs()

Return the right-hand side of this Production.

Return type

sequence(Nonterminal and terminal)