PageRenderTime 18ms CodeModel.GetById 2ms app.highlight 12ms RepoModel.GetById 1ms app.codeStats 0ms

/doc/tagger.Rater-class.html

http://github.com/apresta/tagger
HTML | 341 lines | 293 code | 27 blank | 21 comment | 0 complexity | d67988c878ccfc23d5136ad77f6558e4 MD5 | raw file
  1<?xml version="1.0" encoding="ascii"?>
  2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  3          "DTD/xhtml1-transitional.dtd">
  4<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  5<head>
  6  <title>tagger.Rater</title>
  7  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  8  <script type="text/javascript" src="epydoc.js"></script>
  9</head>
 10
 11<body bgcolor="white" text="black" link="blue" vlink="#204080"
 12      alink="#204080">
 13<!-- ==================== NAVIGATION BAR ==================== -->
 14<table class="navbar" border="0" width="100%" cellpadding="0"
 15       bgcolor="#a0c0ff" cellspacing="0">
 16  <tr valign="middle">
 17
 18  <!-- Tree link -->
 19      <th>&nbsp;&nbsp;&nbsp;<a
 20        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
 21
 22  <!-- Index link -->
 23      <th>&nbsp;&nbsp;&nbsp;<a
 24        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
 25
 26  <!-- Help link -->
 27      <th>&nbsp;&nbsp;&nbsp;<a
 28        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
 29
 30  <!-- Project homepage -->
 31      <th class="navbar" align="right" width="100%">
 32        <table border="0" cellpadding="0" cellspacing="0">
 33          <tr><th class="navbar" align="center"
 34            ><a class="navbar" target="_top" href="http://github.com/apresta/tagger">tagger</a></th>
 35          </tr></table></th>
 36  </tr>
 37</table>
 38<table width="100%" cellpadding="0" cellspacing="0">
 39  <tr valign="top">
 40    <td width="100%">
 41      <span class="breadcrumbs">
 42        <a href="tagger-module.html">Module&nbsp;tagger</a> ::
 43        Class&nbsp;Rater
 44      </span>
 45    </td>
 46    <td>
 47      <table cellpadding="0" cellspacing="0">
 48        <!-- hide/show private -->
 49        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
 50    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
 51        <tr><td align="right"><span class="options"
 52            >[<a href="frames.html" target="_top">frames</a
 53            >]&nbsp;|&nbsp;<a href="tagger.Rater-class.html"
 54            target="_top">no&nbsp;frames</a>]</span></td></tr>
 55      </table>
 56    </td>
 57  </tr>
 58</table>
 59<!-- ==================== CLASS DESCRIPTION ==================== -->
 60<h1 class="epydoc">Class Rater</h1><p class="nomargin-top"><span class="codelink"><a href="tagger-pysrc.html#Rater">source&nbsp;code</a></span></p>
 61<center>
 62<center>  <map id="class_hierarchy_for_rater" name="class_hierarchy_for_rater">
 63<area shape="rect" id="node1" href="extras.NaiveRater-class.html" title="extras.NaiveRater" alt="" coords="5,61,139,88"/>
 64<area shape="rect" id="node2" href="tagger.Rater-class.html" title="Rater" alt="" coords="44,5,100,32"/>
 65</map>
 66  <img src="class_hierarchy_for_rater.gif" alt='' usemap="#class_hierarchy_for_rater" ismap="ismap" class="graph-without-title" />
 67</center>
 68</center>
 69<hr />
 70<p>Class for estimating the relevance of tags</p>
 71  <p>(the default implementation uses TF (term frequency) multiplied by 
 72  weight, but any other reasonable measure is fine; a quite rudimental 
 73  heuristic tries to discard redundant tags)</p>
 74
 75<!-- ==================== INSTANCE METHODS ==================== -->
 76<a name="section-InstanceMethods"></a>
 77<table class="summary" border="1" cellpadding="3"
 78       cellspacing="0" width="100%" bgcolor="white">
 79<tr bgcolor="#70b0f0" class="table-header">
 80  <td colspan="2" class="table-header">
 81    <table border="0" cellpadding="0" cellspacing="0" width="100%">
 82      <tr valign="top">
 83        <td align="left"><span class="table-header">Instance Methods</span></td>
 84        <td align="right" valign="top"
 85         ><span class="options">[<a href="#section-InstanceMethods"
 86         class="privatelink" onclick="toggle_private();"
 87         >hide private</a>]</span></td>
 88      </tr>
 89    </table>
 90  </td>
 91</tr>
 92<tr>
 93    <td width="15%" align="right" valign="top" class="summary">
 94      <span class="summary-type">&nbsp;</span>
 95    </td><td class="summary">
 96      <table width="100%" cellpadding="0" cellspacing="0" border="0">
 97        <tr>
 98          <td><span class="summary-sig"><a href="tagger.Rater-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">self</span>,
 99        <span class="summary-sig-arg">weights</span>,
100        <span class="summary-sig-arg">multitag_size</span>=<span class="summary-sig-default">3</span>)</span><br />
101      Returns:
102      a new <a href="tagger.Rater-class.html" class="link">Rater</a> object</td>
103          <td align="right" valign="top">
104            <span class="codelink"><a href="tagger-pysrc.html#Rater.__init__">source&nbsp;code</a></span>
105            
106          </td>
107        </tr>
108      </table>
109      
110    </td>
111  </tr>
112<tr>
113    <td width="15%" align="right" valign="top" class="summary">
114      <span class="summary-type">&nbsp;</span>
115    </td><td class="summary">
116      <table width="100%" cellpadding="0" cellspacing="0" border="0">
117        <tr>
118          <td><span class="summary-sig"><a href="tagger.Rater-class.html#__call__" class="summary-sig-name">__call__</a>(<span class="summary-sig-arg">self</span>,
119        <span class="summary-sig-arg">tags</span>)</span><br />
120      Returns:
121      a list of unique (multi)tags sorted by relevance</td>
122          <td align="right" valign="top">
123            <span class="codelink"><a href="tagger-pysrc.html#Rater.__call__">source&nbsp;code</a></span>
124            
125          </td>
126        </tr>
127      </table>
128      
129    </td>
130  </tr>
131<tr>
132    <td width="15%" align="right" valign="top" class="summary">
133      <span class="summary-type">&nbsp;</span>
134    </td><td class="summary">
135      <table width="100%" cellpadding="0" cellspacing="0" border="0">
136        <tr>
137          <td><span class="summary-sig"><a href="tagger.Rater-class.html#rate_tags" class="summary-sig-name">rate_tags</a>(<span class="summary-sig-arg">self</span>,
138        <span class="summary-sig-arg">tags</span>)</span></td>
139          <td align="right" valign="top">
140            <span class="codelink"><a href="tagger-pysrc.html#Rater.rate_tags">source&nbsp;code</a></span>
141            
142          </td>
143        </tr>
144      </table>
145      
146    </td>
147  </tr>
148<tr>
149    <td width="15%" align="right" valign="top" class="summary">
150      <span class="summary-type">&nbsp;</span>
151    </td><td class="summary">
152      <table width="100%" cellpadding="0" cellspacing="0" border="0">
153        <tr>
154          <td><span class="summary-sig"><a href="tagger.Rater-class.html#create_multitags" class="summary-sig-name">create_multitags</a>(<span class="summary-sig-arg">self</span>,
155        <span class="summary-sig-arg">tags</span>)</span><br />
156      Returns:
157      a list of multitags</td>
158          <td align="right" valign="top">
159            <span class="codelink"><a href="tagger-pysrc.html#Rater.create_multitags">source&nbsp;code</a></span>
160            
161          </td>
162        </tr>
163      </table>
164      
165    </td>
166  </tr>
167</table>
168<!-- ==================== METHOD DETAILS ==================== -->
169<a name="section-MethodDetails"></a>
170<table class="details" border="1" cellpadding="3"
171       cellspacing="0" width="100%" bgcolor="white">
172<tr bgcolor="#70b0f0" class="table-header">
173  <td colspan="2" class="table-header">
174    <table border="0" cellpadding="0" cellspacing="0" width="100%">
175      <tr valign="top">
176        <td align="left"><span class="table-header">Method Details</span></td>
177        <td align="right" valign="top"
178         ><span class="options">[<a href="#section-MethodDetails"
179         class="privatelink" onclick="toggle_private();"
180         >hide private</a>]</span></td>
181      </tr>
182    </table>
183  </td>
184</tr>
185</table>
186<a name="__init__"></a>
187<div>
188<table class="details" border="1" cellpadding="3"
189       cellspacing="0" width="100%" bgcolor="white">
190<tr><td>
191  <table width="100%" cellpadding="0" cellspacing="0" border="0">
192  <tr valign="top"><td>
193  <h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">self</span>,
194        <span class="sig-arg">weights</span>,
195        <span class="sig-arg">multitag_size</span>=<span class="sig-default">3</span>)</span>
196    <br /><em class="fname">(Constructor)</em>
197  </h3>
198  </td><td align="right" valign="top"
199    ><span class="codelink"><a href="tagger-pysrc.html#Rater.__init__">source&nbsp;code</a></span>&nbsp;
200    </td>
201  </tr></table>
202  
203  
204  <dl class="fields">
205    <dt>Parameters:</dt>
206    <dd><ul class="nomargin-top">
207        <li><strong class="pname"><code>weights</code></strong> - a dictionary of weights normalized in the interval [0,1]</li>
208        <li><strong class="pname"><code>multitag_size</code></strong> - maximum size of tags formed by multiple unit tags</li>
209    </ul></dd>
210    <dt>Returns:</dt>
211        <dd>a new <a href="tagger.Rater-class.html" class="link">Rater</a> 
212          object</dd>
213  </dl>
214</td></tr></table>
215</div>
216<a name="__call__"></a>
217<div>
218<table class="details" border="1" cellpadding="3"
219       cellspacing="0" width="100%" bgcolor="white">
220<tr><td>
221  <table width="100%" cellpadding="0" cellspacing="0" border="0">
222  <tr valign="top"><td>
223  <h3 class="epydoc"><span class="sig"><span class="sig-name">__call__</span>(<span class="sig-arg">self</span>,
224        <span class="sig-arg">tags</span>)</span>
225    <br /><em class="fname">(Call operator)</em>
226  </h3>
227  </td><td align="right" valign="top"
228    ><span class="codelink"><a href="tagger-pysrc.html#Rater.__call__">source&nbsp;code</a></span>&nbsp;
229    </td>
230  </tr></table>
231  
232  
233  <dl class="fields">
234    <dt>Parameters:</dt>
235    <dd><ul class="nomargin-top">
236        <li><strong class="pname"><code>tags</code></strong> - a list of (preferably stemmed) tags</li>
237    </ul></dd>
238    <dt>Returns:</dt>
239        <dd>a list of unique (multi)tags sorted by relevance</dd>
240  </dl>
241</td></tr></table>
242</div>
243<a name="rate_tags"></a>
244<div>
245<table class="details" border="1" cellpadding="3"
246       cellspacing="0" width="100%" bgcolor="white">
247<tr><td>
248  <table width="100%" cellpadding="0" cellspacing="0" border="0">
249  <tr valign="top"><td>
250  <h3 class="epydoc"><span class="sig"><span class="sig-name">rate_tags</span>(<span class="sig-arg">self</span>,
251        <span class="sig-arg">tags</span>)</span>
252  </h3>
253  </td><td align="right" valign="top"
254    ><span class="codelink"><a href="tagger-pysrc.html#Rater.rate_tags">source&nbsp;code</a></span>&nbsp;
255    </td>
256  </tr></table>
257  
258  
259  <dl class="fields">
260    <dt>Parameters:</dt>
261    <dd><ul class="nomargin-top">
262        <li><strong class="pname"><code>tags</code></strong> - a list of tags to be assigned a rating</li>
263    </ul></dd>
264  </dl>
265</td></tr></table>
266</div>
267<a name="create_multitags"></a>
268<div>
269<table class="details" border="1" cellpadding="3"
270       cellspacing="0" width="100%" bgcolor="white">
271<tr><td>
272  <table width="100%" cellpadding="0" cellspacing="0" border="0">
273  <tr valign="top"><td>
274  <h3 class="epydoc"><span class="sig"><span class="sig-name">create_multitags</span>(<span class="sig-arg">self</span>,
275        <span class="sig-arg">tags</span>)</span>
276  </h3>
277  </td><td align="right" valign="top"
278    ><span class="codelink"><a href="tagger-pysrc.html#Rater.create_multitags">source&nbsp;code</a></span>&nbsp;
279    </td>
280  </tr></table>
281  
282  
283  <dl class="fields">
284    <dt>Parameters:</dt>
285    <dd><ul class="nomargin-top">
286        <li><strong class="pname"><code>tags</code></strong> - a list of tags (respecting the order in the text)</li>
287    </ul></dd>
288    <dt>Returns:</dt>
289        <dd>a list of multitags</dd>
290  </dl>
291</td></tr></table>
292</div>
293<br />
294<!-- ==================== NAVIGATION BAR ==================== -->
295<table class="navbar" border="0" width="100%" cellpadding="0"
296       bgcolor="#a0c0ff" cellspacing="0">
297  <tr valign="middle">
298
299  <!-- Tree link -->
300      <th>&nbsp;&nbsp;&nbsp;<a
301        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
302
303  <!-- Index link -->
304      <th>&nbsp;&nbsp;&nbsp;<a
305        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
306
307  <!-- Help link -->
308      <th>&nbsp;&nbsp;&nbsp;<a
309        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
310
311  <!-- Project homepage -->
312      <th class="navbar" align="right" width="100%">
313        <table border="0" cellpadding="0" cellspacing="0">
314          <tr><th class="navbar" align="center"
315            ><a class="navbar" target="_top" href="http://github.com/apresta/tagger">tagger</a></th>
316          </tr></table></th>
317  </tr>
318</table>
319<table border="0" cellpadding="0" cellspacing="0" width="100%%">
320  <tr>
321    <td align="left" class="footer">
322    Generated by Epydoc 3.0.1 on Fri May 13 11:13:08 2011
323    </td>
324    <td align="right" class="footer">
325      <a target="mainFrame" href="http://epydoc.sourceforge.net"
326        >http://epydoc.sourceforge.net</a>
327    </td>
328  </tr>
329</table>
330
331<script type="text/javascript">
332  <!--
333  // Private objects are initially displayed (because if
334  // javascript is turned off then we want them to be
335  // visible); but by default, we want to hide them.  So hide
336  // them unless we have a cookie that says to show them.
337  checkCookie();
338  // -->
339</script>
340</body>
341</html>