The entropy H(x) of a text segment x is defined as Since the occurrence frequencies of characters and words in a document are disperse values, I use the frequencies that a pattern appears in the paragraphs of a document.
a document is firstly segmented into paragraphs, and then a pattern's frequencies in each paragraph are counted.