textstat/resources/TextStat.py
def expectationFromObservationDF1(observation):
   """Returns the expectation values for observation values, assuming a table
      of two columns and two rows represented in a value list observations.
      That is, the first two values are assumed to be row 1, the second two
      values are assumed to be row 2.
      
      A table like:
       -----------------------------------
      |           | class     | not class |
      |-----------------------------------|
      | token     | 34        | 4567      |
      | not token | 16356     | 34985737  |
       -----------------------------------

      is mapped on a list like this, i.e. observations is
      ( 34, 4567, 16356, 34985737 )
      
      the returned corresponding expected values would be:
      (2.15417057091995, 4598.84582942908, 16387.84582942908, 34985705.15417057)
      """
   if len(observation) == 4:
      rowtotal1 = sum(observation[:2])
      rowtotal2 = sum(observation[2:])
      columntotal1 = sum(observation[::2])
      columntotal2 = sum(observation[1::2])
      total = sum(observation)
      return ( (rowtotal1 * columntotal1) / total,
               (rowtotal1 * columntotal2) / total,
               (rowtotal2 * columntotal1) / total,
               (rowtotal2 * columntotal2) / total )
   return None
Returns the expectation values for observation values, assuming a table
      of two columns and two rows represented in a value list observations.
      That is, the first two values are assumed to be row 1, the second two
      values are assumed to be row 2.
      
      A table like:
       -----------------------------------
      |           | class     | not class |
      |-----------------------------------|
      | token     | 34        | 4567      |
      | not token | 16356     | 34985737  |
       -----------------------------------

      is mapped on a list like this, i.e. observations is
      ( 34, 4567, 16356, 34985737 )
      
      the returned corresponding expected values would be:
      (2.15417057091995, 4598.84582942908, 16387.84582942908, 34985705.15417057)
      
Returns the expectation values for observation values, assuming a table
of two columns and two rows represented in a value list observations.
That is, the first two values are assumed to be row 1, the second two
values are assumed to be row 2.

A table like.






Returns the expectation values for observation values assuming a table of two columns and two rows represented in a value list observations . That is the first two values are assumed to be row 1 the second two values are assumed to be row 2 . A table like .
def expectationFromObservationDF1(observation):
   if len(observation) == 4:
      rowtotal1 = sum(observation[:2])
      rowtotal2 = sum(observation[2:])
      columntotal1 = sum(observation[::2])
      columntotal2 = sum(observation[1::2])
      total = sum(observation)
      return ( (rowtotal1 * columntotal1) / total,
               (rowtotal1 * columntotal2) / total,
               (rowtotal2 * columntotal1) / total,
               (rowtotal2 * columntotal2) / total )
   return None
def expectationFromObservationDF1 ( observation ) : if len ( observation ) == 4 : rowtotal1 = sum ( observation [ : 2 ] ) rowtotal2 = sum ( observation [ 2 : ] ) columntotal1 = sum ( observation [ : : 2 ] ) columntotal2 = sum ( observation [ 1 : : 2 ] ) total = sum ( observation ) return ( ( rowtotal1 * columntotal1 ) / total , ( rowtotal1 * columntotal2 ) / total , ( rowtotal2 * columntotal1 ) / total , ( rowtotal2 * columntotal2 ) / total ) return None
Returns the expectation values for observation values, assuming a table
of two columns and two rows represented in a value list observations.
Returns the expectation values for observation values assuming a table of two columns and two rows represented in a value list observations .
"""Returns the expectation values for observation values, assuming a table
      of two columns and two rows represented in a value list observations.
      That is, the first two values are assumed to be row 1, the second two
      values are assumed to be row 2.
      
      A table like:
       -----------------------------------
      |           | class     | not class |
      |-----------------------------------|
      | token     | 34        | 4567      |
      | not token | 16356     | 34985737  |
       -----------------------------------

      is mapped on a list like this, i.e. observations is
      ( 34, 4567, 16356, 34985737 )
      
      the returned corresponding expected values would be:
      (2.15417057091995, 4598.84582942908, 16387.84582942908, 34985705.15417057)
      """
observation