Debian Codegraph @

doc/kyotocabinet-module.html

raw
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>kyotocabinet</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 <!-- Home link -->
18 <th bgcolor="#70b0f0" class="navbar-select"
19 >&nbsp;&nbsp;&nbsp;Home&nbsp;&nbsp;&nbsp;</th>
20
21 <!-- Tree link -->
22 <th>&nbsp;&nbsp;&nbsp;<a
23 href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
24
25 <!-- Index link -->
26 <th>&nbsp;&nbsp;&nbsp;<a
27 href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
28
29 <!-- Help link -->
30 <th>&nbsp;&nbsp;&nbsp;<a
31 href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
32
33 <!-- Project homepage -->
34 <th class="navbar" align="right" width="100%">
35 <table border="0" cellpadding="0" cellspacing="0">
36 <tr><th class="navbar" align="center"
37 >kyotocabinet</th>
38 </tr></table></th>
39 </tr>
40 </table>
41 <table width="100%" cellpadding="0" cellspacing="0">
42 <tr valign="top">
43 <td width="100%">
44 <span class="breadcrumbs">
45 Module&nbsp;kyotocabinet
46 </span>
47 </td>
48 <td>
49 <table cellpadding="0" cellspacing="0">
50 <!-- hide/show private -->
51 <tr><td align="right"><span class="options"
52 >[<a href="frames.html" target="_top">frames</a
53 >]&nbsp;|&nbsp;<a href="kyotocabinet-module.html"
54 target="_top">no&nbsp;frames</a>]</span></td></tr>
55 </table>
56 </td>
57 </tr>
58 </table>
59 <!-- ==================== MODULE DESCRIPTION ==================== -->
60 <h1 class="epydoc">Module kyotocabinet</h1><p class="nomargin-top"></p>
61 <h1 class="heading">Python 3.x Binding of Kyoto Cabinet</h1>
62 <h2 class="heading">Introduction</h2>
63 <p>Kyoto Cabinet is a library of routines for managing a database.
64 The database is a simple data file containing records, each is a pair
65 of a key and a value. Every key and value is serial bytes with
66 variable length. Both binary data and character string can be used
67 as a key and a value. Each key must be unique within a database.
68 There is neither concept of data tables nor data types. Records are
69 organized in hash table or B+ tree.</p>
70 <p>The following access methods are provided to the database: storing
71 a record with a key and a value, deleting a record by a key,
72 retrieving a record by a key. Moreover, traversal access to every
73 key are provided. These access methods are similar to ones of the
74 original DBM (and its followers: NDBM and GDBM) library defined in
75 the UNIX standard. Kyoto Cabinet is an alternative for the DBM
76 because of its higher performance.</p>
77 <p>Each operation of the hash database has the time complexity of
78 &quot;O(1)&quot;. Therefore, in theory, the performance is constant
79 regardless of the scale of the database. In practice, the
80 performance is determined by the speed of the main memory or the
81 storage device. If the size of the database is less than the
82 capacity of the main memory, the performance will seem on-memory
83 speed, which is faster than std::map of STL. Of course, the database
84 size can be greater than the capacity of the main memory and the
85 upper limit is 8 exabytes. Even in that case, each operation needs
86 only one or two seeking of the storage device.</p>
87 <p>Each operation of the B+ tree database has the time complexity of
88 &quot;O(log N)&quot;. Therefore, in theory, the performance is
89 logarithmic to the scale of the database. Although the performance
90 of random access of the B+ tree database is slower than that of the
91 hash database, the B+ tree database supports sequential access in
92 order of the keys, which realizes forward matching search for strings
93 and range search for integers. The performance of sequential access
94 is much faster than that of random access.</p>
95 <p>This library wraps the polymorphic database of the C++ API. So,
96 you can select the internal data structure by specifying the database
97 name in runtime. This library works on Python 3.x (3.1 or later)
98 only. Python 2.x requires another dedicated package.</p>
99 <h2 class="heading">Installation</h2>
100 <p>Install the latest version of Kyoto Cabinet beforehand and get the
101 package of the Python binding of Kyoto Cabinet.</p>
102 <p>Enter the directory of the extracted package then perform
103 installation. If your system has the another command except for the
104 &quot;python3&quot; command, edit the Makefile beforehand.:</p>
105 <pre class="literalblock">
106 make
107 make check
108 su
109 make install
110 </pre>
111 <p>Symbols of the module `kyotocabinet' should be included in each
112 source file of application programs.:</p>
113 <pre class="literalblock">
114 import kyotocabinet
115 </pre>
116 <p>An instance of the class `DB' is used in order to handle a
117 database. You can store, delete, and retrieve records with the
118 instance.</p>
119 <h2 class="heading">Example</h2>
120 <p>The following code is a typical example to use a database.:</p>
121 <pre class="literalblock">
122 from kyotocabinet import *
123 import sys
124
125 # create the database object
126 db = DB()
127
128 # open the database
129 if not db.open(&quot;casket.kch&quot;, DB.OWRITER | DB.OCREATE):
130 print(&quot;open error: &quot; + str(db.error()), file=sys.stderr)
131
132 # store records
133 if not db.set(&quot;foo&quot;, &quot;hop&quot;) or not db.set(&quot;bar&quot;, &quot;step&quot;) or not db.set(&quot;baz&quot;, &quot;jump&quot;):
134 print(&quot;set error: &quot; + str(db.error()), file=sys.stderr)
135
136 # retrieve records
137 value = db.get_str(&quot;foo&quot;)
138 if value:
139 print(value)
140 else:
141 print(&quot;get error: &quot; + str(db.error()), file=sys.stderr)
142
143 # traverse records
144 cur = db.cursor()
145 cur.jump()
146 while True:
147 rec = cur.get_str(True)
148 if not rec: break
149 print(rec[0] + &quot;:&quot; + rec[1])
150 cur.disable()
151
152 # close the database
153 if not db.close():
154 print(&quot;close error: &quot; + str(db.error()), file=sys.stderr)
155 </pre>
156 <p>The following code is a more complex example, which uses the
157 Visitor pattern.:</p>
158 <pre class="literalblock">
159 from kyotocabinet import *
160 import sys
161
162 # create the database object
163 db = DB()
164
165 # open the database
166 if not db.open(&quot;casket.kch&quot;, DB.OREADER):
167 print(&quot;open error: &quot; + str(db.error()), file=sys.stderr)
168
169 # define the visitor
170 class VisitorImpl(Visitor):
171 # call back function for an existing record
172 def visit_full(self, key, value):
173 print(&quot;{}:{}&quot;.format(key.decode(), value.decode()))
174 return self.NOP
175 # call back function for an empty record space
176 def visit_empty(self, key):
177 print(&quot;{} is missing&quot;.format(key.decode()), file=sys.stderr)
178 return self.NOP
179 visitor = VisitorImpl()
180
181 # retrieve a record with visitor
182 if not db.accept(&quot;foo&quot;, visitor, False) or not db.accept(&quot;dummy&quot;, visitor, False):
183 print(&quot;accept error: &quot; + str(db.error()), file=sys.stderr)
184
185 # traverse records with visitor
186 if not db.iterate(visitor, False):
187 print(&quot;iterate error: &quot; + str(db.error()), file=sys.stderr)
188
189 # close the database
190 if not db.close():
191 print(&quot;close error: &quot; + str(db.error()), file=sys.stderr)
192 </pre>
193 <p>The following code is also a complex example, which is more suited
194 to the Python style.:</p>
195 <pre class="literalblock">
196 from kyotocabinet import *
197 import sys
198
199 # define the functor
200 def dbproc(db):
201
202 # store records
203 db[b'foo'] = b'step'; # bytes is fundamental
204 db['bar'] = 'hop'; # string is also ok
205 db[3] = 'jump'; # number is also ok
206
207 # retrieve a record value
208 print(&quot;{}&quot;.format(db['foo'].decode()))
209
210 # update records in transaction
211 def tranproc():
212 db['foo'] = 2.71828
213 return True
214 db.transaction(tranproc)
215
216 # multiply a record value
217 def mulproc(key, value):
218 return float(value) * 2
219 db.accept('foo', mulproc)
220
221 # traverse records by iterator
222 for key in db:
223 print(&quot;{}:{}&quot;.format(key.decode(), db[key].decode()))
224
225 # upcase values by iterator
226 def upproc(key, value):
227 return value.upper()
228 db.iterate(upproc)
229
230 # traverse records by cursor
231 def curproc(cur):
232 cur.jump()
233 def printproc(key, value):
234 print(&quot;{}:{}&quot;.format(key.decode(), value.decode()))
235 return Visitor.NOP
236 while cur.accept(printproc):
237 cur.step()
238 db.cursor_process(curproc)
239
240 # process the database by the functor
241 DB.process(dbproc, 'casket.kch')
242 </pre>
243 <h2 class="heading">License</h2>
244 <p>Copyright (C) 2009-2010 FAL Labs. All rights reserved.</p>
245 <p>Kyoto Cabinet is free software: you can redistribute it and/or
246 modify it under the terms of the GNU General Public License as
247 published by the Free Software Foundation, either version 3 of the
248 License, or any later version.</p>
249 <p>Kyoto Cabinet is distributed in the hope that it will be useful,
250 but WITHOUT ANY WARRANTY; without even the implied warranty of
251 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
252 General Public License for more details.</p>
253
254 <!-- ==================== CLASSES ==================== -->
255 <a name="section-Classes"></a>
256 <table class="summary" border="1" cellpadding="3"
257 cellspacing="0" width="100%" bgcolor="white">
258 <tr bgcolor="#70b0f0" class="table-header">
259 <td align="left" colspan="2" class="table-header">
260 <span class="table-header">Classes</span></td>
261 </tr>
262 <tr>
263 <td width="15%" align="right" valign="top" class="summary">
264 <span class="summary-type">&nbsp;</span>
265 </td><td class="summary">
266 <a href="kyotocabinet.Error-class.html" class="summary-name">Error</a><br />
267 Error data.
268 </td>
269 </tr>
270 <tr>
271 <td width="15%" align="right" valign="top" class="summary">
272 <span class="summary-type">&nbsp;</span>
273 </td><td class="summary">
274 <a href="kyotocabinet.Visitor-class.html" class="summary-name">Visitor</a><br />
275 Interface to access a record.
276 </td>
277 </tr>
278 <tr>
279 <td width="15%" align="right" valign="top" class="summary">
280 <span class="summary-type">&nbsp;</span>
281 </td><td class="summary">
282 <a href="kyotocabinet.FileProcessor-class.html" class="summary-name">FileProcessor</a><br />
283 Interface to process the database file.
284 </td>
285 </tr>
286 <tr>
287 <td width="15%" align="right" valign="top" class="summary">
288 <span class="summary-type">&nbsp;</span>
289 </td><td class="summary">
290 <a href="kyotocabinet.Cursor-class.html" class="summary-name">Cursor</a><br />
291 Interface of cursor to indicate a record.
292 </td>
293 </tr>
294 <tr>
295 <td width="15%" align="right" valign="top" class="summary">
296 <span class="summary-type">&nbsp;</span>
297 </td><td class="summary">
298 <a href="kyotocabinet.DB-class.html" class="summary-name">DB</a><br />
299 Interface of database abstraction.
300 </td>
301 </tr>
302 </table>
303 <!-- ==================== FUNCTIONS ==================== -->
304 <a name="section-Functions"></a>
305 <table class="summary" border="1" cellpadding="3"
306 cellspacing="0" width="100%" bgcolor="white">
307 <tr bgcolor="#70b0f0" class="table-header">
308 <td align="left" colspan="2" class="table-header">
309 <span class="table-header">Functions</span></td>
310 </tr>
311 <tr>
312 <td width="15%" align="right" valign="top" class="summary">
313 <span class="summary-type">&nbsp;</span>
314 </td><td class="summary">
315 <table width="100%" cellpadding="0" cellspacing="0" border="0">
316 <tr>
317 <td><span class="summary-sig"><a href="kyotocabinet-module.html#conv_bytes" class="summary-sig-name">conv_bytes</a>(<span class="summary-sig-arg">obj</span>)</span><br />
318 Convert any object to a string.</td>
319 <td align="right" valign="top">
320
321
322 </td>
323 </tr>
324 </table>
325
326 </td>
327 </tr>
328 <tr>
329 <td width="15%" align="right" valign="top" class="summary">
330 <span class="summary-type">&nbsp;</span>
331 </td><td class="summary">
332 <table width="100%" cellpadding="0" cellspacing="0" border="0">
333 <tr>
334 <td><span class="summary-sig"><a href="kyotocabinet-module.html#atoi" class="summary-sig-name">atoi</a>(<span class="summary-sig-arg">str</span>)</span><br />
335 Convert a string to an integer.</td>
336 <td align="right" valign="top">
337
338
339 </td>
340 </tr>
341 </table>
342
343 </td>
344 </tr>
345 <tr>
346 <td width="15%" align="right" valign="top" class="summary">
347 <span class="summary-type">&nbsp;</span>
348 </td><td class="summary">
349 <table width="100%" cellpadding="0" cellspacing="0" border="0">
350 <tr>
351 <td><span class="summary-sig"><a href="kyotocabinet-module.html#atoix" class="summary-sig-name">atoix</a>(<span class="summary-sig-arg">str</span>)</span><br />
352 Convert a string with a metric prefix to an integer.</td>
353 <td align="right" valign="top">
354
355
356 </td>
357 </tr>
358 </table>
359
360 </td>
361 </tr>
362 <tr>
363 <td width="15%" align="right" valign="top" class="summary">
364 <span class="summary-type">&nbsp;</span>
365 </td><td class="summary">
366 <table width="100%" cellpadding="0" cellspacing="0" border="0">
367 <tr>
368 <td><span class="summary-sig"><a href="kyotocabinet-module.html#atof" class="summary-sig-name">atof</a>(<span class="summary-sig-arg">str</span>)</span><br />
369 Convert a string to a real number.</td>
370 <td align="right" valign="top">
371
372
373 </td>
374 </tr>
375 </table>
376
377 </td>
378 </tr>
379 <tr>
380 <td width="15%" align="right" valign="top" class="summary">
381 <span class="summary-type">&nbsp;</span>
382 </td><td class="summary">
383 <table width="100%" cellpadding="0" cellspacing="0" border="0">
384 <tr>
385 <td><span class="summary-sig"><a href="kyotocabinet-module.html#hash_murmur" class="summary-sig-name">hash_murmur</a>(<span class="summary-sig-arg">str</span>)</span><br />
386 Get the hash value of a string by MurMur hashing.</td>
387 <td align="right" valign="top">
388
389
390 </td>
391 </tr>
392 </table>
393
394 </td>
395 </tr>
396 <tr>
397 <td width="15%" align="right" valign="top" class="summary">
398 <span class="summary-type">&nbsp;</span>
399 </td><td class="summary">
400 <table width="100%" cellpadding="0" cellspacing="0" border="0">
401 <tr>
402 <td><span class="summary-sig"><a href="kyotocabinet-module.html#hash_fnv" class="summary-sig-name">hash_fnv</a>(<span class="summary-sig-arg">str</span>)</span><br />
403 Get the hash value of a string by FNV hashing.</td>
404 <td align="right" valign="top">
405
406
407 </td>
408 </tr>
409 </table>
410
411 </td>
412 </tr>
413 <tr>
414 <td width="15%" align="right" valign="top" class="summary">
415 <span class="summary-type">&nbsp;</span>
416 </td><td class="summary">
417 <table width="100%" cellpadding="0" cellspacing="0" border="0">
418 <tr>
419 <td><span class="summary-sig"><a href="kyotocabinet-module.html#levdist" class="summary-sig-name">levdist</a>(<span class="summary-sig-arg">a</span>,
420 <span class="summary-sig-arg">b</span>,
421 <span class="summary-sig-arg">utf</span>)</span><br />
422 Calculate the levenshtein distance of two strings.</td>
423 <td align="right" valign="top">
424
425
426 </td>
427 </tr>
428 </table>
429
430 </td>
431 </tr>
432 </table>
433 <!-- ==================== VARIABLES ==================== -->
434 <a name="section-Variables"></a>
435 <table class="summary" border="1" cellpadding="3"
436 cellspacing="0" width="100%" bgcolor="white">
437 <tr bgcolor="#70b0f0" class="table-header">
438 <td align="left" colspan="2" class="table-header">
439 <span class="table-header">Variables</span></td>
440 </tr>
441 <tr>
442 <td width="15%" align="right" valign="top" class="summary">
443 <span class="summary-type">&nbsp;</span>
444 </td><td class="summary">
445 <a name="VERSION"></a><span class="summary-name">VERSION</span> = <code title="'x.y.z'"><code class="variable-quote">'</code><code class="variable-string">x.y.z</code><code class="variable-quote">'</code></code><br />
446 The version information.
447 </td>
448 </tr>
449 <tr>
450 <td width="15%" align="right" valign="top" class="summary">
451 <span class="summary-type">&nbsp;</span>
452 </td><td class="summary">
453 <a name="__package__"></a><span class="summary-name">__package__</span> = <code title="None">None</code>
454 </td>
455 </tr>
456 </table>
457 <!-- ==================== FUNCTION DETAILS ==================== -->
458 <a name="section-FunctionDetails"></a>
459 <table class="details" border="1" cellpadding="3"
460 cellspacing="0" width="100%" bgcolor="white">
461 <tr bgcolor="#70b0f0" class="table-header">
462 <td align="left" colspan="2" class="table-header">
463 <span class="table-header">Function Details</span></td>
464 </tr>
465 </table>
466 <a name="conv_bytes"></a>
467 <div>
468 <table class="details" border="1" cellpadding="3"
469 cellspacing="0" width="100%" bgcolor="white">
470 <tr><td>
471 <table width="100%" cellpadding="0" cellspacing="0" border="0">
472 <tr valign="top"><td>
473 <h3 class="epydoc"><span class="sig"><span class="sig-name">conv_bytes</span>(<span class="sig-arg">obj</span>)</span>
474 </h3>
475 </td><td align="right" valign="top"
476 >&nbsp;
477 </td>
478 </tr></table>
479
480 <p>Convert any object to a string.</p>
481 <dl class="fields">
482 <dt>Parameters:</dt>
483 <dd><ul class="nomargin-top">
484 <li><strong class="pname"><code>obj</code></strong> - the object.</li>
485 </ul></dd>
486 <dt>Returns:</dt>
487 <dd>the result string.</dd>
488 </dl>
489 </td></tr></table>
490 </div>
491 <a name="atoi"></a>
492 <div>
493 <table class="details" border="1" cellpadding="3"
494 cellspacing="0" width="100%" bgcolor="white">
495 <tr><td>
496 <table width="100%" cellpadding="0" cellspacing="0" border="0">
497 <tr valign="top"><td>
498 <h3 class="epydoc"><span class="sig"><span class="sig-name">atoi</span>(<span class="sig-arg">str</span>)</span>
499 </h3>
500 </td><td align="right" valign="top"
501 >&nbsp;
502 </td>
503 </tr></table>
504
505 <p>Convert a string to an integer.</p>
506 <dl class="fields">
507 <dt>Parameters:</dt>
508 <dd><ul class="nomargin-top">
509 <li><strong class="pname"><code>str</code></strong> - specifies the string.</li>
510 </ul></dd>
511 <dt>Returns:</dt>
512 <dd>the integer. If the string does not contain numeric expression,
513 0 is returned.</dd>
514 </dl>
515 </td></tr></table>
516 </div>
517 <a name="atoix"></a>
518 <div>
519 <table class="details" border="1" cellpadding="3"
520 cellspacing="0" width="100%" bgcolor="white">
521 <tr><td>
522 <table width="100%" cellpadding="0" cellspacing="0" border="0">
523 <tr valign="top"><td>
524 <h3 class="epydoc"><span class="sig"><span class="sig-name">atoix</span>(<span class="sig-arg">str</span>)</span>
525 </h3>
526 </td><td align="right" valign="top"
527 >&nbsp;
528 </td>
529 </tr></table>
530
531 <p>Convert a string with a metric prefix to an integer.</p>
532 <dl class="fields">
533 <dt>Parameters:</dt>
534 <dd><ul class="nomargin-top">
535 <li><strong class="pname"><code>str</code></strong> - the string, which can be trailed by a binary metric prefix.
536 &quot;K&quot;, &quot;M&quot;, &quot;G&quot;, &quot;T&quot;,
537 &quot;P&quot;, and &quot;E&quot; are supported. They are
538 case-insensitive.</li>
539 </ul></dd>
540 <dt>Returns:</dt>
541 <dd>the integer. If the string does not contain numeric expression,
542 0 is returned. If the integer overflows the domain, INT64_MAX or
543 INT64_MIN is returned according to the sign.</dd>
544 </dl>
545 </td></tr></table>
546 </div>
547 <a name="atof"></a>
548 <div>
549 <table class="details" border="1" cellpadding="3"
550 cellspacing="0" width="100%" bgcolor="white">
551 <tr><td>
552 <table width="100%" cellpadding="0" cellspacing="0" border="0">
553 <tr valign="top"><td>
554 <h3 class="epydoc"><span class="sig"><span class="sig-name">atof</span>(<span class="sig-arg">str</span>)</span>
555 </h3>
556 </td><td align="right" valign="top"
557 >&nbsp;
558 </td>
559 </tr></table>
560
561 <p>Convert a string to a real number.</p>
562 <dl class="fields">
563 <dt>Parameters:</dt>
564 <dd><ul class="nomargin-top">
565 <li><strong class="pname"><code>str</code></strong> - specifies the string.</li>
566 </ul></dd>
567 <dt>Returns:</dt>
568 <dd>the real number. If the string does not contain numeric
569 expression, 0.0 is returned.</dd>
570 </dl>
571 </td></tr></table>
572 </div>
573 <a name="hash_murmur"></a>
574 <div>
575 <table class="details" border="1" cellpadding="3"
576 cellspacing="0" width="100%" bgcolor="white">
577 <tr><td>
578 <table width="100%" cellpadding="0" cellspacing="0" border="0">
579 <tr valign="top"><td>
580 <h3 class="epydoc"><span class="sig"><span class="sig-name">hash_murmur</span>(<span class="sig-arg">str</span>)</span>
581 </h3>
582 </td><td align="right" valign="top"
583 >&nbsp;
584 </td>
585 </tr></table>
586
587 <p>Get the hash value of a string by MurMur hashing.</p>
588 <dl class="fields">
589 <dt>Parameters:</dt>
590 <dd><ul class="nomargin-top">
591 <li><strong class="pname"><code>str</code></strong> - the string.</li>
592 </ul></dd>
593 <dt>Returns:</dt>
594 <dd>the hash value.</dd>
595 </dl>
596 </td></tr></table>
597 </div>
598 <a name="hash_fnv"></a>
599 <div>
600 <table class="details" border="1" cellpadding="3"
601 cellspacing="0" width="100%" bgcolor="white">
602 <tr><td>
603 <table width="100%" cellpadding="0" cellspacing="0" border="0">
604 <tr valign="top"><td>
605 <h3 class="epydoc"><span class="sig"><span class="sig-name">hash_fnv</span>(<span class="sig-arg">str</span>)</span>
606 </h3>
607 </td><td align="right" valign="top"
608 >&nbsp;
609 </td>
610 </tr></table>
611
612 <p>Get the hash value of a string by FNV hashing.</p>
613 <dl class="fields">
614 <dt>Parameters:</dt>
615 <dd><ul class="nomargin-top">
616 <li><strong class="pname"><code>str</code></strong> - the string.</li>
617 </ul></dd>
618 <dt>Returns:</dt>
619 <dd>the hash value.</dd>
620 </dl>
621 </td></tr></table>
622 </div>
623 <a name="levdist"></a>
624 <div>
625 <table class="details" border="1" cellpadding="3"
626 cellspacing="0" width="100%" bgcolor="white">
627 <tr><td>
628 <table width="100%" cellpadding="0" cellspacing="0" border="0">
629 <tr valign="top"><td>
630 <h3 class="epydoc"><span class="sig"><span class="sig-name">levdist</span>(<span class="sig-arg">a</span>,
631 <span class="sig-arg">b</span>,
632 <span class="sig-arg">utf</span>)</span>
633 </h3>
634 </td><td align="right" valign="top"
635 >&nbsp;
636 </td>
637 </tr></table>
638
639 <p>Calculate the levenshtein distance of two strings.</p>
640 <dl class="fields">
641 <dt>Parameters:</dt>
642 <dd><ul class="nomargin-top">
643 <li><strong class="pname"><code>a</code></strong> - one string.</li>
644 <li><strong class="pname"><code>b</code></strong> - the other string.</li>
645 <li><strong class="pname"><code>utf</code></strong> - flag to treat keys as UTF-8 strings.</li>
646 </ul></dd>
647 <dt>Returns:</dt>
648 <dd>the levenshtein distance.</dd>
649 </dl>
650 </td></tr></table>
651 </div>
652 <br />
653 <!-- ==================== NAVIGATION BAR ==================== -->
654 <table class="navbar" border="0" width="100%" cellpadding="0"
655 bgcolor="#a0c0ff" cellspacing="0">
656 <tr valign="middle">
657 <!-- Home link -->
658 <th bgcolor="#70b0f0" class="navbar-select"
659 >&nbsp;&nbsp;&nbsp;Home&nbsp;&nbsp;&nbsp;</th>
660
661 <!-- Tree link -->
662 <th>&nbsp;&nbsp;&nbsp;<a
663 href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
664
665 <!-- Index link -->
666 <th>&nbsp;&nbsp;&nbsp;<a
667 href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
668
669 <!-- Help link -->
670 <th>&nbsp;&nbsp;&nbsp;<a
671 href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
672
673 <!-- Project homepage -->
674 <th class="navbar" align="right" width="100%">
675 <table border="0" cellpadding="0" cellspacing="0">
676 <tr><th class="navbar" align="center"
677 >kyotocabinet</th>
678 </tr></table></th>
679 </tr>
680 </table>
681 <table border="0" cellpadding="0" cellspacing="0" width="100%%">
682 <tr>
683 <td align="left" class="footer">
684 Generated by Epydoc 3.0.1 on Fri May 25 01:00:16 2012
685 </td>
686 <td align="right" class="footer">
687 <a target="mainFrame" href="http://epydoc.sourceforge.net"
688 >http://epydoc.sourceforge.net</a>
689 </td>
690 </tr>
691 </table>
692
693 <script type="text/javascript">
694 <!--
695 // Private objects are initially displayed (because if
696 // javascript is turned off then we want them to be
697 // visible); but by default, we want to hide them. So hide
698 // them unless we have a cookie that says to show them.
699 checkCookie();
700 // -->
701 </script>
702 </body>
703 </html>