class_docstr: A collection of bigram association measures. Each association measure
  is provided as a function with three arguments::
  
      bigram_score_fn(n_ii, (n_ix, n_xi), n_xx)
  
  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_ii counts ``(w1, w2)``, i.e. the bigram being scored
  - n_ix counts ``(w1, *)``
  - n_xi counts ``(*, w2)``
  - n_xx counts ``(*, *)``, i.e. any bigram
  
  This may be shown with respect to a contingency table::
  
              w1    ~w1
           ------ ------
       w2 | n_ii | n_oi | = n_xi
           ------ ------
      ~w2 | n_io | n_oo |
           ------ ------
           = n_ix        TOTAL = n_xx
class_docstr_tok: ["A","collection","of","bigram","association","measures",".","Each","association","measure","is","provided","as","a","function","with","three","arguments",":",":","bigram_score_fn","(","n_ii",",","(","n_ix",",","n_xi",")",",","n_xx",")","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_ii","counts","``","(","w1",",","w2",")","``",",","i.e",".","the","bigram","being","scored","-","n_ix","counts","``","(","w1",",","*",")","``","-","n_xi","counts","``","(","*",",","w2",")","``","-","n_xx","counts","``","(","*",",","*",")","``",",","i.e",".","any","bigram","This","may","be","shown","with","respect","to","a","contingency","table",":",":","w1","~w1","--","--","--","--","--","--","w2","|","n_ii","|","n_oi","|","=","n_xi","--","--","--","--","--","--","~w2","|","n_io","|","n_oo","|","--","--","--","--","--","--","=","n_ix","TOTAL","=","n_xx"]
docstr: Calculates expected values for a contingency table.
docstr_tok: ["Calculates","expected","values","for","a","contingency","table","."]
code: def _expected_values(cont):
      """Calculates expected values for a contingency table."""
      n_xx = sum(cont)
      # For each contingency table cell
      for i in range(4):
          yield (cont[i] + cont[i ^ 1]) * (cont[i] + cont[i ^ 2]) / n_xx
  
imports: import math
  from abc import ABCMeta, abstractmethod
  from functools import reduce
label_desc: Use image node_id 3 for calling the BigramAssocMeasures obj's underlying member method code with example usage: obj._expected_values(cont) without return types