Package nltk :: Package metrics :: Module association :: Class TrigramAssocMeasures
[hide private]
[frames] | no frames]

type TrigramAssocMeasures

source code

        object --+    
                 |    
NgramAssocMeasures --+
                     |
                    TrigramAssocMeasures


A collection of trigram association measures. Each association measure
is provided as a function with four arguments:
    trigram_score_fn(n_iii,
                     (n_iix, n_ixi, n_xii),
                     (n_ixx, n_xix, n_xxi),
                     n_xxx)
The arguments constitute the marginals of a contingency table, counting
the occurrences of particular events in a corpus. The letter i in the
suffix refers to the appearance of the word in question, while x indicates
the appearance of any word. Thus, for example:
n_iii counts (w1, w2, w3), i.e. the trigram being scored
n_ixx counts (w1, *, *)
n_xxx counts (*, *, *), i.e. any trigram

Class Methods [hide private]

Inherited from NgramAssocMeasures: chi_sq, jaccard, likelihood_ratio, pmi, poisson_stirling, student_t

Inherited from NgramAssocMeasures (private): _expected_values

Static Methods [hide private]
 
_contingency(n_iii, (n_iix, n_ixi, n_xii), (n_ixx, n_xix, n_xxi), n_xxx)
Calculates values of a trigram contingency table (or cube) from marginal values.
source code
 
_marginals(*contingency)
Calculates values of contingency table marginals from its values.
source code

Inherited from NgramAssocMeasures: mi_like, raw_freq

Class Variables [hide private]
  _n = 3
Method Details [hide private]

_contingency(n_iii, (n_iix, n_ixi, n_xii), (n_ixx, n_xix, n_xxi), n_xxx)
Static Method

source code 

Calculates values of a trigram contingency table (or cube) from marginal values.

Overrides: NgramAssocMeasures._contingency

_marginals(*contingency)
Static Method

source code 

Calculates values of contingency table marginals from its values.

Overrides: NgramAssocMeasures._marginals