textstat/resources/TextStat.py
def highestNTermsChi2(docfprof, corpfprof, n=10):
   """Returns a list of the first n tokens with the highest Chi2 score.
      """
   doctotal  = sum(docfprof.values())
   corptotal = sum(corpfprof.values())
   res = [ (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) ]
   res.sort(key=itemgetter(1), reverse=True)
   return (i[0] for i in res[:n])
Returns a list of the first n tokens with the highest Chi2 score.
      
Returns a list of the first n tokens with the highest Chi2 score.
Returns a list of the first n tokens with the highest Chi2 score .
def highestNTermsChi2(docfprof, corpfprof, n=10):
   doctotal  = sum(docfprof.values())
   corptotal = sum(corpfprof.values())
   res = [ (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) ]
   res.sort(key=itemgetter(1), reverse=True)
   return (i[0] for i in res[:n])
def highestNTermsChi2 ( docfprof , corpfprof , n = 10 ) : doctotal = sum ( docfprof . values ( ) ) corptotal = sum ( corpfprof . values ( ) ) res = [ ( 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 ) ] res . sort ( key = itemgetter ( 1 ) , reverse = True ) return ( i [ 0 ] for i in res [ : n ] )
Returns a list of the first n tokens with the highest Chi2 score.
Returns a list of the first n tokens with the highest Chi2 score .
"""Returns a list of the first n tokens with the highest Chi2 score.
      """
docfprof
corpfprof
n