class documentation

Interface for parsing with BLLIP Parser. BllipParser objects can be constructed with the BllipParser.from_unified_model_dir class method or manually using the BllipParser constructor.

Class Method from_unified_model_dir Create a BllipParser object from a unified parsing model directory. Unified parsing model directories are a standardized way of storing BLLIP parser and reranker models together on disk. See bllipparser.RerankingParser.get_unified_model_parameters()...
Method __init__ Load a BLLIP Parser model from scratch. You'll typically want to use the from_unified_model_dir() class method to construct this object.
Method parse Use BLLIP Parser to parse a sentence. Takes a sentence as a list of words; it will be automatically tagged with this BLLIP Parser instance's tagger.
Method tagged_parse Use BLLIP to parse a sentence. Takes a sentence as a list of (word, tag) tuples; the sentence must have already been tokenized and tagged. BLLIP will attempt to use the tags provided but may use others if it can't come up with a complete parse subject to those constraints...
Instance Variable rrp Undocumented

Inherited from ParserI:

Method grammar No summary
Method parse_all No summary
Method parse_one No summary
Method parse_sents Apply self.parse() to each element of sents. :rtype: iter(iter(Tree))
@classmethod
def from_unified_model_dir(cls, model_dir, parser_options=None, reranker_options=None): (source)

Create a BllipParser object from a unified parsing model directory. Unified parsing model directories are a standardized way of storing BLLIP parser and reranker models together on disk. See bllipparser.RerankingParser.get_unified_model_parameters() for more information about unified model directories.

models in the model directory.

bllipparser.RerankingParser.RerankingParser.load_parser_options() for more information. :type parser_options: dict(str) :param reranker_options: optional dictionary of reranker options, see bllipparser.RerankingParser.RerankingParser.load_reranker_model() for more information. :type reranker_options: dict(str) :rtype: BllipParser

Parameters
model_dir:strPath to the unified model directory.
parser_optionsoptional dictionary of parser options, see
reranker_optionsUndocumented
Returns
A BllipParser object using the parser and reranker
def __init__(self, parser_model=None, reranker_features=None, reranker_weights=None, parser_options=None, reranker_options=None): (source)

Load a BLLIP Parser model from scratch. You'll typically want to use the from_unified_model_dir() class method to construct this object.

bllipparser.RerankingParser.RerankingParser.load_parser_options() for more information. :type parser_options: dict(str)

dictionary of reranker options, see bllipparser.RerankingParser.RerankingParser.load_reranker_model() for more information. :type reranker_options: dict(str)

Parameters
parser_model:strPath to parser model directory
reranker_features:strPath the reranker model's features file
reranker_weights:strPath the reranker model's weights file
parser_optionsoptional dictionary of parser options, see
reranker_optionsoptional
def parse(self, sentence): (source)

Use BLLIP Parser to parse a sentence. Takes a sentence as a list of words; it will be automatically tagged with this BLLIP Parser instance's tagger.

from most likely to least likely.

Parameters
sentence:list(str)The sentence to be parsed
Returns
iter(Tree)An iterator that generates parse trees for the sentence
def tagged_parse(self, word_and_tag_pairs): (source)

Use BLLIP to parse a sentence. Takes a sentence as a list of (word, tag) tuples; the sentence must have already been tokenized and tagged. BLLIP will attempt to use the tags provided but may use others if it can't come up with a complete parse subject to those constraints. You may also specify a tag as None to leave a token's tag unconstrained.

from most likely to least likely.

Parameters
word_and_tag_pairsUndocumented
sentence:list(tuple(str, str))Input sentence to parse as (word, tag) pairs
Returns
iter(Tree)An iterator that generates parse trees for the sentence

Undocumented