Skip to content

Commit

Permalink
Issue #554: Improved Top 20 Words
Browse files Browse the repository at this point in the history
* Added word stemming using Snowball JS library
* Stripping parentheses and quotes
* Closes #566
  • Loading branch information
mwilkie authored and ginatrapani committed Jan 25, 2011
1 parent f845ac0 commit 0bec25a
Show file tree
Hide file tree
Showing 4 changed files with 278 additions and 18 deletions.
1 change: 1 addition & 0 deletions webapp/_lib/view/post.index.tpl
Expand Up @@ -108,6 +108,7 @@
</div> </div>
{if $post->reply_count_cache > $top_20_post_min} {if $post->reply_count_cache > $top_20_post_min}
{include file="_post.word-frequency.tpl"} {include file="_post.word-frequency.tpl"}
<script src="{$site_root_path}assets/js/extlib/Snowball.stemmer.min.js" type="text/javascript"></script>
<script src="{$site_root_path}assets/js/word_frequency.js" type="text/javascript"></script> <script src="{$site_root_path}assets/js/word_frequency.js" type="text/javascript"></script>
{/if} {/if}
{if !$logged_in_user && $private_reply_count > 0} {if !$logged_in_user && $private_reply_count > 0}
Expand Down
50 changes: 50 additions & 0 deletions webapp/assets/html/test/word_frequency.html
@@ -0,0 +1,50 @@
<html>
<head><title>word frequency test</title></head>

<link rel="shortcut icon" type="image/x-icon" href="../../img/favicon.png">
<link type="text/css" rel="stylesheet" href="../../assets/css/base.css">
<link type="text/css" rel="stylesheet" href="../../assets/css/positioning.css">
<link type="text/css" rel="stylesheet" href="../../assets/css/style.css">
<link type="text/css" rel="stylesheet" href="../../assets/css/jquery-ui-1.7.1.custom.css">

<!-- jquery -->
<link type="text/css" rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script type="text/javascript" src="../../js/extlib/Snowball.stemmer.min.js"></script>

<script type="text/javascript" src="../../js/word_frequency.js"></script>

<body>

<div class="word-frequency"></div>
<div id="word-frequency-close"></div>
<div id="word-frequency-spinner"></div>
<div id="word-frequency-posts-div"></div>
<div id="word-frequency-posts-close"></div>

<div id="word-frequency-list" style="display: none;">
Top 20 Word list:
<div class="word-frequency-div" id="word-frequency-words">
</div>
</div>

<div id="word-frequency-posts" style="border: solid green 1px; padding: 10px; margin: 10px;"></div>

<div style="border: solid black 1px; padding: 10px; margin: 10px;">
<div class="reply_text" id="reply_text-1">I have some text here I like to reply with. #stuff also tweet sign "sign"</div><br />
<div class="reply_text" id="reply_text-2">I have some more text here, I like it likes. #stuff</div><br />
<div class="reply_text" id="reply_text-3">(apples and apple) and rest and "rested" and I tweeted and log</div><br />
<div class="reply_text" id="reply_text-4">I like eating and to eat "and i ate." and I like texting when i am texted and tweeting</div><br />
<div class="reply_text" id="reply_text-5">when i am "eating" I like to reply to texts when I am replying to texts I have texted to when texted and texting. ("also, I like eats.")</div><br />
<div class="reply_text" id="reply_text-6">I use "log" when I actually log in the database the act. When I an just granting access it's "sign". Many years of govt work.</div><br />
<div class="reply_text" id="reply_text-7">"how many tweets do you eat?" have you replied to those eats?</div><br />
</div>

<script type="text/javascript">


tu_word_freq.find_words();
</script>
</body>
</html>

0 comments on commit 0bec25a

Please sign in to comment.