textstat/resources/TextStat.py
def significantTermsChi2(docfprof, corpfprof):
   """Returns a list of significant terms from a document, given the documents
      frequency profile and the corpus frequency profile.
      
      The significance test is based on Chi2.
      
      Parameters:
      
      docfprof: absolute frequency profile for one document.
      
      corpfprof: absolute freqeuncy profile for the complete corpus.
      
      It is presupposed that all terms in docfprof are also in corpfprof,
      although, this function is robust wrt. this assumption.
      """
   doctotal  = sum(docfprof.values())
   corptotal = sum(corpfprof.values())
   return (k[0] for k in ((j[0], chi2Score(j[1:],expectationFromObservationDF1(j[1:]))) for j in ((i, docfprof.get(i, 0), corpfprof.get(i, 0) - docfprof.get(i, 0), doctotal - docfprof.get(i, 0), corptotal - (corpfprof.get(i, 0) - docfprof.get(i, 0))) for i in docfprof)) if k[1] >= df1chi2sigscore)
Returns a list of significant terms from a document, given the documents
      frequency profile and the corpus frequency profile.
      
      The significance test is based on Chi2.
      
      Parameters:
      
      docfprof: absolute frequency profile for one document.
      
      corpfprof: absolute freqeuncy profile for the complete corpus.
      
      It is presupposed that all terms in docfprof are also in corpfprof,
      although, this function is robust wrt. this assumption.
      
Returns a list of significant terms from a document, given the documents
frequency profile and the corpus frequency profile.

The significance test is based on Chi2.



absolute frequency profile for one document.

absolute freqeuncy profile for the complete corpus.

It is presupposed that all terms in docfprof are also in corpfprof,
although, this function is robust wrt. this assumption.
Returns a list of significant terms from a document given the documents frequency profile and the corpus frequency profile . The significance test is based on Chi2 . absolute frequency profile for one document . absolute freqeuncy profile for the complete corpus . It is presupposed that all terms in docfprof are also in corpfprof although this function is robust wrt . this assumption .
def significantTermsChi2(docfprof, corpfprof):
   doctotal  = sum(docfprof.values())
   corptotal = sum(corpfprof.values())
   return (k[0] for k in ((j[0], chi2Score(j[1:],expectationFromObservationDF1(j[1:]))) for j in ((i, docfprof.get(i, 0), corpfprof.get(i, 0) - docfprof.get(i, 0), doctotal - docfprof.get(i, 0), corptotal - (corpfprof.get(i, 0) - docfprof.get(i, 0))) for i in docfprof)) if k[1] >= df1chi2sigscore)
def significantTermsChi2 ( docfprof , corpfprof ) : doctotal = sum ( docfprof . values ( ) ) corptotal = sum ( corpfprof . values ( ) ) return ( k [ 0 ] for k in ( ( j [ 0 ] , chi2Score ( j [ 1 : ] , expectationFromObservationDF1 ( j [ 1 : ] ) ) ) for j in ( ( i , docfprof . get ( i , 0 ) , corpfprof . get ( i , 0 ) - docfprof . get ( i , 0 ) , doctotal - docfprof . get ( i , 0 ) , corptotal - ( corpfprof . get ( i , 0 ) - docfprof . get ( i , 0 ) ) ) for i in docfprof ) ) if k [ 1 ] >= df1chi2sigscore )
Returns a list of significant terms from a document, given the documents
frequency profile and the corpus frequency profile.
Returns a list of significant terms from a document given the documents frequency profile and the corpus frequency profile .
"""Returns a list of significant terms from a document, given the documents
      frequency profile and the corpus frequency profile.
      
      The significance test is based on Chi2.
      
      Parameters:
      
      docfprof: absolute frequency profile for one document.
      
      corpfprof: absolute freqeuncy profile for the complete corpus.
      
      It is presupposed that all terms in docfprof are also in corpfprof,
      although, this function is robust wrt. this assumption.
      """
docfprof
corpfprof