Package nltk :: Package parse :: Module nonprojectivedependencyparser :: Class NaiveBayesDependencyScorer
[hide private]
[frames] | no frames]

type NaiveBayesDependencyScorer

source code

       object --+    
                |    
DependencyScorerI --+
                    |
                   NaiveBayesDependencyScorer

A dependency scorer built around a MaxEnt classifier. In this particular class that classifier is a NaiveBayesClassifier. It uses head-word, head-tag, child-word, and child-tag features for classification.

Instance Methods [hide private]
 
__init__(self) source code
 
train(self, graphs)
Trains a NaiveBayesClassifier using the edges present in graphs list as positive examples, the edges not present as negative examples.
source code
3 dimensional list
score(self, graph)
Converts the graph into a feature-based representation of each edge, and then assigns a score to each based on the confidence of the classifier in assigning it to the positive label.
source code

Inherited from DependencyScorerI: __cmp__, __hash__

Method Details [hide private]

__init__(self)
(Constructor)

source code 
Overrides: DependencyScorerI.__init__

train(self, graphs)

source code 

Trains a NaiveBayesClassifier using the edges present in graphs list as positive examples, the edges not present as negative examples. Uses a feature vector of head-word, head-tag, child-word, and child-tag.

Parameters:
  • graphs (A list of DependencyGraph) - A list of dependency graphs to train the scorer.
Overrides: DependencyScorerI.train

score(self, graph)

source code 

Converts the graph into a feature-based representation of each edge, and then assigns a score to each based on the confidence of the classifier in assigning it to the positive label. Scores are returned in a multidimensional list.

Parameters:
  • graph (DependencyGraph) - A dependency graph to score.
Returns: 3 dimensional list
Edge scores for the graph parameter.
Overrides: DependencyScorerI.score