docstr: Direct quote from Gries (2019)
  
  Finally, Gries (2008, 2010) and the follow-up by Lijffijt and Gries (2012)
  proposed a measure called DP (for deviation of proportions), which falls between
  1-min s (for an extremely even distribution) and 1 (for an extremely clumpy
  distribution) as well as a normalized version of DP, DPnorm, which falls between 0
  and 1, which are computed as shown in (13). For DP, one computes the differences
  between how much of the element in question is in each corpus file in percent on the
  one hand and the sizes of the corpus parts in percent on the other – i.e. the differences
  between observed and expected percentages. Then, one adds up the absolute values
  of those and multiplies by 0.5; the normalization then consists of dividing this values
  by the theoretically maximum value of DP given the number of corpus parts (in a
  way reminiscent of (11)
docstr_tok: ["Direct","quote","from","Gries","(","2019",")","Finally",",","Gries","(","2008",",","2010",")","and","the","follow-up","by","Lijffijt","and","Gries","(","2012",")","proposed","a","measure","called","DP","(","for","deviation","of","proportions",")",",","which","falls","between","1-min","s","(","for","an","extremely","even","distribution",")","and","1","(","for","an","extremely","clumpy","distribution",")","as","well","as","a","normalized","version","of","DP",",","DPnorm",",","which","falls","between","0","and","1",",","which","are","computed","as","shown","in","(","13",")",".","For","DP",",","one","computes","the","differences","between","how","much","of","the","element","in","question","is","in","each","corpus","file","in","percent","on","the","one","hand","and","the","sizes","of","the","corpus","parts","in","percent","on","the","other","\u2013","i.e",".","the","differences","between","observed","and","expected","percentages",".","Then",",","one","adds","up","the","absolute","values","of","those","and","multiplies","by","0.5",";","the","normalization","then","consists","of","dividing","this","values","by","the","theoretically","maximum","value","of","DP","given","the","number","of","corpus","parts","(","in","a","way","reminiscent","of","(","11",")"]
code: def dp(self):
      """
      Direct quote from Gries (2019)
  
      Finally, Gries (2008, 2010) and the follow-up by Lijffijt and Gries (2012)
      proposed a measure called DP (for deviation of proportions), which falls between
      1-min s (for an extremely even distribution) and 1 (for an extremely clumpy
      distribution) as well as a normalized version of DP, DPnorm, which falls between 0
      and 1, which are computed as shown in (13). For DP, one computes the differences
      between how much of the element in question is in each corpus file in percent on the
      one hand and the sizes of the corpus parts in percent on the other – i.e. the differences
      between observed and expected percentages. Then, one adds up the absolute values
      of those and multiplies by 0.5; the normalization then consists of dividing this values
      by the theoretically maximum value of DP given the number of corpus parts (in a
      way reminiscent of (11)"""
      return (
          np.sum(
              np.abs(
                  self.v.multiply(1.0 / self.get_frequency()) - self.s
              ),
              axis=0,
          ).A1
          / 2
      )
  
imports: from typing import Optional, Callable, List
  import numpy
  import pandas
  from scattertext.termranking import AbsoluteFrequencyRanker
  from scipy.sparse import csc_matrix, csr_matrix
  from sklearn.preprocessing import StandardScaler
  from scattertext.smoothing.lowess import Lowess
  from scattertext.termranking.TermRanker import TermRanker
  from scattertext.TermDocMatrix import TermDocMatrix
label_desc: Use image node_id 8 for calling the Dispersion obj's underlying member method code with example usage: obj.dp() and returns: unknown