class BllipParser(ParserI): (source)
Constructor: BllipParser(parser_model, reranker_features, reranker_weights, parser_options, reranker_options)
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 |
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 |
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 |
No summary |
Method | parse |
No summary |
Method | parse |
Apply self.parse() to each element of sents. :rtype: iter(iter(Tree)) |
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 | Path to the unified model directory. |
parser | optional dictionary of parser options, see |
reranker | Undocumented |
Returns | |
A BllipParser object using the parser and reranker |
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 | Path to parser model directory |
reranker | Path the reranker model's features file |
reranker | Path the reranker model's weights file |
parser | optional dictionary of parser options, see |
reranker | optional |
nltk.parse.api.ParserI.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.
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 |
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 | Undocumented |
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 |