{"id":912,"date":"2005-05-28T11:37:40","date_gmt":"2005-05-28T19:37:40","guid":{"rendered":"http:\/\/www.kathrynpetroharper.com\/mindfullife\/2005\/05\/28\/wanted-a-weighted-words-list\/"},"modified":"2026-01-21T16:23:49","modified_gmt":"2026-01-22T00:23:49","slug":"wanted-a-weighted-words-list","status":"publish","type":"post","link":"https:\/\/www.kathrynpetroharper.com\/mindfullife\/2005\/05\/28\/wanted-a-weighted-words-list\/","title":{"rendered":"Wanted: A Weighted Words List"},"content":{"rendered":"<p>Does anyone know how to create a weight words list?  I have the code below, which I found by following the trail from <a href=\"http:\/\/www.bookish.dk\/\">Bookish<\/a>, but the <a href=\"http:\/\/www.danandsherree.com\/2004\/12\/28\/building_a_weighted_.php\">instructions on the website<\/a> are extremely minimal for a geek wannabe like me.  I&#8217;ve tinkered with it (put it in an index table as instructed) but alas, no success.  I&#8217;m curious to see how mine would look.<br \/>\n<!--more--><br \/>\n&lt;?php<\/p>\n<p>\/\/ Build the list of words and convert everything to lowercase.<br \/>\n$string = strtolower(&#8216;&lt;MTEntries lastn=&#8221;10000&#8243;&gt;&lt;MTEntryCategory remove_html=&#8221;1&#8243; encode_php=&#8221;q&#8221;&gt; &lt;MTEntryTitle remove_html=&#8221;1&#8243; encode_php=&#8221;q&#8221;&gt; &lt;MTEntryBody remove_html=&#8221;1&#8243; encode_php=&#8221;q&#8221;&gt; &lt;MTEntryMore remove_html=&#8221;1&#8243; encode_php=&#8221;q&#8221;&gt; &lt;\/MTEntries&gt;&lt;MTOtherBlog blog_id=&#8221;7&#8243;&gt;&lt;MTEntries lastn=&#8221;10000&#8243;&gt;&lt;MTEntryCategory remove_html=&#8221;1&#8243; encode_php=&#8221;q&#8221;&gt; &lt;MTEntryTitle remove_html=&#8221;1&#8243; encode_php=&#8221;q&#8221;&gt; &lt;MTEntryBody remove_html=&#8221;1&#8243; encode_php=&#8221;q&#8221;&gt; &lt;\/MTEntries&gt;&lt;\/MTOtherBlog&gt;&#8217;);<\/p>\n<p>\/\/ Remove punctuation.<br \/>\n$wordlist = preg_split(&#8216;\/\\s*[\\s+\\.|\\?|,|(|)|\\-+|\\&#8217;|\\&#8221;|=|;|&#0215;|\\$|\\\/|:|{|}]\\s*\/i&#8217;, $string);<\/p>\n<p>\/\/ Build an array of the unique words and number of times they occur.<br \/>\n$a = array_count_values( $wordlist );<\/p>\n<p>\/\/Remove words that don&#8217;t matter&#8211;&#8220;stop words.&#8221;<br \/>\n$overusedwords = array( &#8221;, &#8216;a&#8217;, &#8216;an&#8217;, &#8216;the&#8217;, &#8216;and&#8217;, &#8216;of&#8217;, &#8216;i&#8217;, &#8216;to&#8217;, &#8216;is&#8217;, &#8216;in&#8217;, &#8216;with&#8217;, &#8216;for&#8217;, &#8216;as&#8217;, &#8216;that&#8217;, &#8216;on&#8217;, &#8216;at&#8217;, &#8216;this&#8217;, &#8216;my&#8217;, &#8216;was&#8217;, &#8216;our&#8217;, &#8216;it&#8217;, &#8216;you&#8217;, &#8216;we&#8217;, &#8216;1&#8217;, &#8216;2&#8217;, &#8216;3&#8217;, &#8216;4&#8217;, &#8216;5&#8217;, &#8216;6&#8217;, &#8216;7&#8217;, &#8216;8&#8217;, &#8216;9&#8217;, &#8216;0&#8217;, &#8217;10&#8217;, &#8216;about&#8217;, &#8216;after&#8217;, &#8216;all&#8217;, &#8216;almost&#8217;, &#8216;along&#8217;, &#8216;also&#8217;, &#8216;amp&#8217;, &#8216;another&#8217;, &#8216;any&#8217;, &#8216;are&#8217;, &#8216;area&#8217;, &#8216;around&#8217;, &#8216;available&#8217;, &#8216;back&#8217;, &#8216;be&#8217;, &#8216;because&#8217;, &#8216;been&#8217;, &#8216;being&#8217;, &#8216;best&#8217;, &#8216;better&#8217;, &#8216;big&#8217;, &#8216;bit&#8217;, &#8216;both&#8217;, &#8216;but&#8217;, &#8216;by&#8217;, &#8216;c&#8217;, &#8216;came&#8217;, &#8216;can&#8217;, &#8216;capable&#8217;, &#8216;control&#8217;, &#8216;could&#8217;, &#8216;course&#8217;, &#8216;d&#8217;, &#8216;dan&#8217;, &#8216;day&#8217;, &#8216;decided&#8217;, &#8216;did&#8217;, &#8216;didn&#8217;, &#8216;different&#8217;, &#8216;div&#8217;, &#8216;do&#8217;, &#8216;doesn&#8217;, &#8216;don&#8217;, &#8216;down&#8217;, &#8216;drive&#8217;, &#8216;e&#8217;, &#8216;each&#8217;, &#8216;easily&#8217;, &#8216;easy&#8217;, &#8216;edition&#8217;, &#8216;end&#8217;, &#8216;enough&#8217;, &#8216;even&#8217;, &#8216;every&#8217;, &#8216;example&#8217;, &#8216;few&#8217;, &#8216;find&#8217;, &#8216;first&#8217;, &#8216;found&#8217;, &#8216;from&#8217;, &#8216;get&#8217;, &#8216;go&#8217;, &#8216;going&#8217;, &#8216;good&#8217;, &#8216;got&#8217;, &#8216;gt&#8217;, &#8216;had&#8217;, &#8216;hard&#8217;, &#8216;has&#8217;, &#8216;have&#8217;, &#8216;he&#8217;, &#8216;her&#8217;, &#8216;here&#8217;, &#8216;how&#8217;, &#8216;if&#8217;, &#8216;into&#8217;, &#8216;isn&#8217;, &#8216;just&#8217;, &#8216;know&#8217;, &#8216;last&#8217;, &#8216;left&#8217;, &#8216;li&#8217;, &#8216;like&#8217;, &#8216;little&#8217;, &#8216;ll&#8217;, &#8216;long&#8217;, &#8216;look&#8217;, &#8216;lot&#8217;, &#8216;lt&#8217;, &#8216;m&#8217;, &#8216;made&#8217;, &#8216;make&#8217;, &#8216;many&#8217;, &#8216;mb&#8217;, &#8216;me&#8217;, &#8216;menu&#8217;, &#8216;might&#8217;, &#8216;mm&#8217;, &#8216;more&#8217;, &#8216;most&#8217;, &#8216;much&#8217;, &#8216;name&#8217;, &#8216;nbsp&#8217;, &#8216;need&#8217;, &#8216;new&#8217;, &#8216;no&#8217;, &#8216;not&#8217;, &#8216;now&#8217;, &#8216;number&#8217;, &#8216;off&#8217;, &#8216;old&#8217;, &#8216;one&#8217;, &#8216;only&#8217;, &#8216;or&#8217;, &#8216;original&#8217;, &#8216;other&#8217;, &#8216;out&#8217;, &#8216;over&#8217;, &#8216;part&#8217;, &#8216;place&#8217;, &#8216;point&#8217;, &#8216;pretty&#8217;, &#8216;probably&#8217;, &#8216;problem&#8217;, &#8216;put&#8217;, &#8216;quite&#8217;, &#8216;quot&#8217;, &#8216;r&#8217;, &#8216;re&#8217;, &#8216;really&#8217;, &#8216;results&#8217;, &#8216;right&#8217;, &#8216;s&#8217;, &#8216;same&#8217;, &#8216;saw&#8217;, &#8216;see&#8217;, &#8216;set&#8217;, &#8216;several&#8217;, &#8216;she&#8217;, &#8216;sherree&#8217;, &#8216;should&#8217;, &#8216;since&#8217;, &#8216;size&#8217;, &#8216;small&#8217;, &#8216;so&#8217;, &#8216;some&#8217;, &#8216;something&#8217;, &#8216;special&#8217;, &#8216;still&#8217;, &#8216;stuff&#8217;, &#8216;such&#8217;, &#8216;sure&#8217;, &#8216;system&#8217;, &#8216;t&#8217;, &#8216;take&#8217;, &#8216;than&#8217;, &#8216;their&#8217;, &#8216;them&#8217;, &#8216;then&#8217;, &#8216;there&#8217;, &#8216;these&#8217;, &#8216;they&#8217;, &#8216;thing&#8217;, &#8216;things&#8217;, &#8216;think&#8217;, &#8216;those&#8217;, &#8216;though&#8217;, &#8216;through&#8217;, &#8216;time&#8217;, &#8216;today&#8217;, &#8216;together&#8217;, &#8216;too&#8217;, &#8216;took&#8217;, &#8216;two&#8217;, &#8216;up&#8217;, &#8216;us&#8217;, &#8216;use&#8217;, &#8216;used&#8217;, &#8216;using&#8217;, &#8216;ve&#8217;, &#8216;very&#8217;, &#8216;want&#8217;, &#8216;way&#8217;, &#8216;well&#8217;, &#8216;went&#8217;, &#8216;were&#8217;, &#8216;what&#8217;, &#8216;when&#8217;, &#8216;where&#8217;, &#8216;which&#8217;, &#8216;while&#8217;, &#8216;white&#8217;, &#8216;who&#8217;, &#8216;will&#8217;, &#8216;would&#8217;, &#8216;your&#8217;);<\/p>\n<p>\/\/ Remove the stop words from the list.<br \/>\nforeach ($overusedwords as $word) {<br \/>\n unset( $a[$word] ); }<\/p>\n<p>\/\/ Sort the keys alphabetically.<br \/>\nksort( $a );<\/p>\n<p>\/\/ Print the data.<br \/>\necho &#8216;&lt;p class=&#8221;noindent&#8221;&gt;&#8217;;<\/p>\n<p>\/\/ Assign a font-size to the word based on frequency of use.<br \/>\nforeach ($a as $word =&gt; $count) {<br \/>\n if ($count &lt;= 35) { $size = 75;<br \/>\n } elseif ($count &lt;= 50) { $size = 100;<br \/>\n } elseif ($count &lt;= 65) { $size = 125;<br \/>\n } elseif ($count &lt;= 80) { $size = 150;<br \/>\n } elseif ($count &lt;= 95) { $size = 175;<br \/>\n } elseif ($count &lt;= 110) { $size = 200;<br \/>\n } elseif ($count &lt;= 125) { $size = 225;<br \/>\n } elseif ($count &lt;= 140) { $size = 250;<br \/>\n } elseif ($count &lt;= 155) { $size = 275;<br \/>\n } elseif ($count &lt;= 170) { $size = 300;<br \/>\n } elseif ($count &lt;= 200) { $size = 340; }<\/p>\n<p>\/\/ The keyword needs to be referenced 30 or more times to register.<br \/>\n if ($count &gt;= 30) {<br \/>\n   echo &#8216; &lt;span style=&#8221;font-size: &#8216; . $size . &#8216;%;&#8221;&gt;&lt;acronym title=&#8221;This keyword occurs &#8216; . $count . &#8216; times.&#8221;&gt;&#8217; . $word . &#8216;&lt;\/acronym&gt;&lt;\/span&gt; &#8216;; }<br \/>\n}<\/p>\n<p>echo &#8216;&lt;\/p&gt;&#8217;;<\/p>\n<p>?&gt;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Does anyone know how to create a weight words list? I have the code below, which I found by following the trail from Bookish, but the instructions on the website are extremely minimal for a geek wannabe like me. I&#8217;ve tinkered with it (put it in an index table as instructed) but alas, no success. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[28,14],"tags":[],"class_list":["post-912","post","type-post","status-publish","format-standard","hentry","category-humanities","category-technology"],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/www.kathrynpetroharper.com\/mindfullife\/wp-json\/wp\/v2\/posts\/912","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kathrynpetroharper.com\/mindfullife\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kathrynpetroharper.com\/mindfullife\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kathrynpetroharper.com\/mindfullife\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kathrynpetroharper.com\/mindfullife\/wp-json\/wp\/v2\/comments?post=912"}],"version-history":[{"count":1,"href":"https:\/\/www.kathrynpetroharper.com\/mindfullife\/wp-json\/wp\/v2\/posts\/912\/revisions"}],"predecessor-version":[{"id":12594,"href":"https:\/\/www.kathrynpetroharper.com\/mindfullife\/wp-json\/wp\/v2\/posts\/912\/revisions\/12594"}],"wp:attachment":[{"href":"https:\/\/www.kathrynpetroharper.com\/mindfullife\/wp-json\/wp\/v2\/media?parent=912"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kathrynpetroharper.com\/mindfullife\/wp-json\/wp\/v2\/categories?post=912"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kathrynpetroharper.com\/mindfullife\/wp-json\/wp\/v2\/tags?post=912"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}