PageRenderTime 31ms CodeModel.GetById 14ms app.highlight 13ms RepoModel.GetById 1ms app.codeStats 0ms

/doc/tagger.tagger.Rater-class.html

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