Parsing

Chunk parsers

RegexpChunkParser

A regular expression based chunk parser.

RegexpParser

A grammar based chunk parser.

ne_chunk(tagged_tokens[, binary])

Use NLTK's currently recommended named entity chunker to chunk the given list of tagged tokens.

ne_chunk_sents(tagged_sentences[, binary])

Use NLTK's currently recommended named entity chunker to chunk the given list of tagged sentences, each consisting of a list of tagged tokens.

ChunkScore

A utility class for scoring chunk parsers.

accuracy(chunker, gold)

Score the accuracy of the chunker against the gold standard.

conllstr2tree(s[, chunk_types, root_label])

Return a chunk structure for a single sentence encoded in the given CONLL 2000 style string.

conlltags2tree(sentence[, chunk_types, ...])

Convert the CoNLL IOB format to a tree.

ieerstr2tree(s[, chunk_types, root_label])

Return a chunk structure containing the chunked tagged text that is encoded in the given IEER style string.

tagstr2tree(s[, chunk_label, root_label, ...])

Divide a string of bracketted tagged text into chunks and unchunked tokens, and produce a Tree.

tree2conllstr(t)

Return a multiline string where each line contains a word, tag and IOB tag.

tree2conlltags(t)

Return a list of 3-tuples containing (word, tag, IOB-tag).

CFG parsers

BottomUpChartParser

A ChartParser using a bottom-up parsing strategy.

BottomUpLeftCornerChartParser

A ChartParser using a bottom-up left-corner parsing strategy.

LeftCornerChartParser

SteppingChartParser

A ChartParser that allows you to step through the parsing process, adding a single edge at a time.

TopDownChartParser

A ChartParser using a top-down parsing strategy.

EarleyChartParser

IncrementalBottomUpChartParser

IncrementalBottomUpLeftCornerChartParser

IncrementalChartParser

An incremental chart parser implementing Jay Earley's parsing algorithm:

IncrementalLeftCornerChartParser

IncrementalTopDownChartParser

RecursiveDescentParser

A simple top-down CFG parser that parses texts by recursively expanding the fringe of a Tree, and matching it against a text.

SteppingRecursiveDescentParser

A RecursiveDescentParser that allows you to step through the parsing process, performing a single operation at a time.

ShiftReduceParser

A simple bottom-up CFG parser that uses two operations, "shift" and "reduce", to find a single parse for a text.

SteppingShiftReduceParser

A ShiftReduceParser that allows you to setp through the parsing process, performing a single operation at a time.

TransitionParser

Class for transition based parser.

PCFG parsers

BottomUpProbabilisticChartParser

An abstract bottom-up parser for PCFG grammars that uses a Chart to record partial results.

InsideChartParser

A bottom-up parser for PCFG grammars that tries edges in descending order of the inside probabilities of their trees.

LongestChartParser

A bottom-up parser for PCFG grammars that tries longer edges before shorter ones.

RandomChartParser

A bottom-up parser for PCFG grammars that tries edges in random order.

UnsortedChartParser

A bottom-up parser for PCFG grammars that tries edges in whatever order.

ViterbiParser

A bottom-up PCFG parser that uses dynamic programming to find the single most likely parse for a text.

Unification parsers

FeatureEarleyChartParser

FeatureIncrementalBottomUpChartParser

FeatureIncrementalBottomUpLeftCornerChartParser

FeatureIncrementalChartParser

FeatureIncrementalTopDownChartParser

FeatureBottomUpChartParser

FeatureBottomUpLeftCornerChartParser

FeatureTopDownChartParser

Dependency parsers

DependencyEvaluator

Class for measuring labelled and unlabelled attachment score for dependency parsing.

NaiveBayesDependencyScorer

A dependency scorer built around a MaxEnt classifier.

NonprojectiveDependencyParser

A non-projective, rule-based, dependency parser.

ProbabilisticNonprojectiveParser

A probabilistic non-projective dependency parser.

ProbabilisticProjectiveDependencyParser

A probabilistic, projective dependency parser.

ProjectiveDependencyParser

A projective, rule-based, dependency parser.

Combinatory Categorial Grammar

CCGChart

CCGChartParser

Chart parser for CCGs.

CCGEdge

CCGLeafEdge

Class representing leaf edges in a CCG derivation.

BackwardApplication

The backward equivalent of the ForwardCombinator class.

BackwardBx

The backward equivalent of the ForwardCombinator class.

BackwardCombinator

The backward equivalent of the ForwardCombinator class.

BackwardComposition

The backward equivalent of the ForwardCombinator class.

BackwardSx

The backward equivalent of the ForwardCombinator class.

BackwardT

The backward equivalent of the ForwardCombinator class.

DirectedBinaryCombinator

Wrapper for the undirected binary combinator.

ForwardApplication

Class representing combinators where the primary functor is on the left.

ForwardCombinator

Class representing combinators where the primary functor is on the left.

ForwardComposition

Class representing combinators where the primary functor is on the left.

ForwardSubstitution

Class representing combinators where the primary functor is on the left.

ForwardT

Class representing combinators where the primary functor is on the left.

UndirectedBinaryCombinator

Abstract class for representing a binary combinator.

UndirectedComposition

Functional composition (harmonic) combinator.

UndirectedFunctionApplication

Class representing function application.

UndirectedSubstitution

Substitution (permutation) combinator.

UndirectedTypeRaise

Undirected combinator for type raising.

CCGLexicon

Class representing a lexicon for CCG grammars.

Third party parsers

BllipParser

Interface for parsing with BLLIP Parser.

CoreNLPDependencyParser

Dependency parser.

CoreNLPParser

>>> parser = CoreNLPParser(url='http://localhost:9000')

MaltParser

A class for dependency parsing with MaltParser.

Visualizations

chartparser()

chunkparser()

rdparser()

Create a recursive descent parser demo, using a simple grammar and text.

srparser()

Create a shift reduce parser app, using a simple grammar and text.