nltk.TransitionParser

class nltk.TransitionParser(algorithm)[source]

Class for transition based parser. Implement 2 algorithms which are “arc-standard” and “arc-eager”

Methods

__init__(algorithm)
param algorithm:
 the algorithm option of this parser. Currently support arc-standard and arc-eager algorithm
grammar()
return:The grammar used by this parser.
parse(depgraphs, modelFile)
param depgraphs:
 the list of test sentence, each sentence is represented as a dependency graph where the ‘head’ information is dummy
parse_all(sent, *args, **kwargs)
rtype:list(Tree)
parse_one(sent, *args, **kwargs)
rtype:Tree or None
parse_sents(sents, *args, **kwargs) Apply self.parse() to each element of sents.
train(depgraphs, modelfile) :param depgraphs : list of DependencyGraph as the training data