Package nltk :: Package parse :: Module malt :: Class MaltParser
[hide private]
[frames] | no frames]

type MaltParser

source code

 object --+    
          |    
api.ParserI --+
              |
             MaltParser

Instance Methods [hide private]
 
__init__(self, tagger=None) source code
 
config_malt(self, bin=None, verbose=False)
Configure NLTK's interface to the malt package.
source code
Tree
parse(self, sentence, verbose=False)
Use MaltParser to parse a sentence.
source code
 
raw_parse(self, sentence, verbose=False)
Use MaltParser to parse a sentence.
source code
 
tagged_parse(self, sentence, verbose=False)
Use MaltParser to parse a sentence.
source code
 
train(self, depgraphs, verbose=False)
Train MaltParser from a list of DependencyGraphs
source code
 
train_from_file(self, conll_file, verbose=False)
Train MaltParser from a file
source code
 
_execute(self, cmd, type, verbose=False) source code

Inherited from api.ParserI: batch_iter_parse, batch_nbest_parse, batch_parse, batch_prob_parse, grammar, iter_parse, nbest_parse, prob_parse

    Deprecated

Inherited from api.ParserI: batch_test, get_parse, get_parse_dict, get_parse_list, get_parse_prob

Method Details [hide private]

__init__(self, tagger=None)
(Constructor)

source code 
Overrides: object.__init__
(inherited documentation)

config_malt(self, bin=None, verbose=False)

source code 

Configure NLTK's interface to the malt package. This searches for a directory containing the malt jar

Parameters:
  • bin (string) - The full path to the malt binary. If not specified, then nltk will search the system for a malt binary; and if one is not found, it will raise a LookupError exception.

parse(self, sentence, verbose=False)

source code 

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

Parameters:
  • sentence (list of string) - Input sentence to parse
Returns: Tree
DependencyGraph the dependency graph representation of the sentence
Overrides: api.ParserI.parse

raw_parse(self, sentence, verbose=False)

source code 

Use MaltParser to parse a sentence. Takes a sentence as a string; before parsing, it will be automatically tokenized and tagged with this MaltParser instance's tagger.

Parameters:
  • sentence (string) - Input sentence to parse
Returns:
DependencyGraph the dependency graph representation of the sentence

tagged_parse(self, sentence, verbose=False)

source code 

Use MaltParser to parse a sentence. Takes a sentence as a list of (word, tag) tuples; the sentence must have already been tokenized and tagged.

Parameters:
  • sentence (list of (word, tag) tuples.) - Input sentence to parse
Returns:
DependencyGraph the dependency graph representation of the sentence

train(self, depgraphs, verbose=False)

source code 

Train MaltParser from a list of DependencyGraphs

Parameters:
  • depgraphs - list of DependencyGraphs for training input data

train_from_file(self, conll_file, verbose=False)

source code 

Train MaltParser from a file

Parameters:
  • conll_file - str for the filename of the training input data