Python extension for computing string edit distances and similarities.
- Project description
- Project details
- Release history
- Download files
Project description
Maintainer wanted
I am looking for a new maintainer to the project as it is apparent that I haven’t had the need for this particular library for well over 7 years now, due to it being a C-only library and its somewhat restrictive original license.
Introduction
The Levenshtein Python C extension module contains functions for fast computation of
- Levenshtein [edit] distance, and edit operations
- string similarity
- approximate median strings, and generally string averaging
- string sequence and set similarity
It supports both normal and Unicode strings.
Python 2.2 or newer is required; Python 3 is supported.
StringMatcher.py is an example SequenceMatcher-like class built on the top of Levenshtein. It misses some SequenceMatcher’s functionality, and has some extra OTOH.
Levenshtein.c can be used as a pure C library, too. You only have to define NO_PYTHON preprocessor symbol [-DNO_PYTHON] when compiling it. The functionality is similar to that of the Python extension. No separate docs are provided yet, RTFS. But they are not interchangeable:
- C functions exported when compiling with -DNO_PYTHON [see Levenshtein.h] are not exported when compiling as a Python extension [and vice versa]
- Unicode character type used with -DNO_PYTHON is wchar_t, Python extension uses Py_UNICODE, they may be the same but don’t count on it
Documentation
- Documentation for the current version
gendoc.sh generates HTML API documentation, you probably want a selfcontained instead of includable version, so run in ./gendoc.sh --selfcontained. It needs Levenshtein already installed and genextdoc.py.
License
Levenshtein is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or [at your option] any later version.
See the file COPYING for the full text of GNU General Public License version 2.
History
This package was long missing from the Python Package Index and available as source checkout only, but can now be found on PyPI again.
We needed to restore this package for Go Mobile for Plone and Pywurfl projects which depend on this.
Authors
- Maintainer: Antti Haapala
- Python 3 compatibility: Esa Määttä
- Jonatas CD: Fixed documentation generation
- Previous maintainer: Mikko Ohtamaa
- Original code: David Necas [Yeti]
Changelog
0.12.1
- Fixed handling of numerous possible wraparounds in calculating the size of memory allocations; incorrect handling of which could cause denial of service or even possible remote code execution in previous versions of the library.
0.12.0
- Fixed a bug in StringMatcher.StringMatcher.get_matching_blocks / extract_editops for Python 3; now allow only str editops on both Python 2 and Python 3, for simpler and working code.
- Added documentation in the source distribution and in GIT
- Fixed the package layout: renamed the .so/.dll to _levenshtein, and made it reside inside a package, along with the StringMatcher class.
- Fixed spelling errors.
0.11.2
- Fixed a bug in setup.py: installation would fail on Python 3 if the locale did not specify UTF-8 charset [Felix Yan].
- Added COPYING, StringMatcher.py, gendoc.sh and NEWS in MANIFEST.in, as they were missing from source distributions.
0.11.1
- Added Levenshtein.h to MANIFEST.in
0.11.0
- Python 3 support, maintainership passed to Antti Haapala
0.10.1 - 0.10.2
- Made python-Lehvenstein Git compatible and use setuptools for PyPi upload
- Created HISTORY.txt and made README reST compatible
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hướng dẫn dùng push py python
Mục lụcNội dung chínhNội dung chínhMục lục1- Python List 2- Truy cập các phần tử của danh sách 3- Cập nhập danh sách 4- Xóa phần tử trong danh sách 5- Các toán ...
Hướng dẫn dùng def statement python
Hướng dẫn sử dụng def trong python. Bạn sẽ học được cách sử dụng def để khai báo hàm trong python, cũng như cách gọi hàm trong python đã được khai báo sau ...
Hướng dẫn insert python là gì
Hàm List insert[] trong Python chèn đối tượng obj vào trong list tại chỉ số index đã cho. Hàm này không trả về bất kỳ giá trị nào nhưng nó chèn phần tử đã cho ...
How to display tree structure in python
Hi you may give itertree a try [Im the author].The package goes in the direction of anytree package but with a bit different focus. The performance on huge trees [>100000 items] is much better ...
Hướng dẫn dùng concatenated string python
String concatenation means add strings together.Python Variables Tutorial Creating Variables Variable Names Assign Value to Multiple Variables Output Variables Global VariablesCopyright ©2022 ...
Hướng dẫn dùng trying meaning python
Từ điển trong Python là danh sách các giá trị dữ liệu không được sắp xếp và có thể được thay đổi bằng cách sử dụng các phương thức tích hợp sẵn. ...
Hướng dẫn dùng object python python
Đã đăng vào thg 5 17, 2019 5:41 CH 5 phút đọc Chào tất cả mọi người. Ở bài viết trước mình đã giới thiệu cho các bạn về hàm và cách sử dụng của nó. ...
Hướng dẫn dùng nest dictionary python
In Python, a dictionary is an unordered collection of items. For example:dictionary = {key : value, key_2: value_2}Here, dictionary has a key:value pair enclosed within curly brackets {}.To ...
Hướng dẫn initialize float in python
Blog Tin tức 19/01/2022 10:15Nội dung chínhPython Float là gì?Pythons Float hoạt động như thế nào? Ví dụ về phương thức Float []1. Chuyển đổi một số nguyên thành ...
Thư viện json trong python
Json [JavaScript Object Notation] là một chuẩn định dạng được dùng để lưu trữ và trao đổi dữ liệu giữa các tiến trình với nhau. Như tên gọi gợi ý phần ...
Hướng dẫn dùng python training python
Nhóm phát triển của chúng tôi vừa ra mắt website langlearning.net học tiếng Anh, Nga, Đức, Pháp, Việt, Trung, Hàn, Nhật, ... miễn phí cho tất cả mọi người. Là ...
Hướng dẫn dùng midrange formula python
Vietnamese [Tiếng Việt] translation by Dai Phong [you can also view the original English article] Phân tích số liệu thống kê giúp chúng ta hiểu được toàn bộ thông tin. ...
Hướng dẫn dùng python xor python
Nội dung chínhNội dung chínhBit trong python là gì?Khái niệm bitỨng dụng của bit trong pythonToán tử bitwise trong Python [còn gọi là toán tử Biwter trong Python]Bảng ...
How to make a quiz with random questions in python
Well, random.randint[] returns a list with integers put in a random number. What you really need is random.shuffle[]. So you should make a list [Ill call it questions] because random.shuffle only ...
How do you read a sparse matrix in python?
The documentation for this transform method says it returns a sparse matrix, but doesnt specify the kind. Different kinds let you access the data in different ways, but it is easy to convert one to ...
How to make python code run again
Im trying to restart a program using an if-test based on the input from the user.This code doesnt work, but its approximately what Im after:answer = str[raw_input[Run again? [y/n]: ]] if ...
What is an attribute in a class python?
I had a programming interview recently, a phone-screen in which we used a collaborative text editor.I was asked to implement a certain API, and chose to do so in Python. Abstracting away the problem ...
Hướng dẫn dùng python mysql python
MySQL là một hệ cơ sở dữ liệu quan hệ phổ biến nhất hiện nay. Rất nhiều ngôn ngữ có thể kết nối đến MySQL và Python cũng không ngoại lệ.Mặc định ...
Convert complex to int python
I built a calculator for a bio equation, and I think Ive narrowed down the source of my problem, which is a natural log I take:goldman = [[R * T] / F] * cmath.log[float[top_row] / ...
Hướng dẫn argmax python
Trong hướng dẫn này, bạn sẽ học cách sử dụng hàm NumPy argmax [] để tìm chỉ số của phần tử tối đa trong mảng.NumPy là một thư viện mạnh mẽ cho tính ...
Hướng dẫn dùng matlab print python
Tổng quanGần đây trong công việc của mình, tôi đã viết lại các thuật toán được phát triển trong MatLab sang Python , một số hàm không đơn giản để thích ...
Tìm ước của một số python
Trong bài này ta sẽ viết chương trình Python liệt kê tất cả các ước số của N với N được nhập vào từ bàn phím.Ví dụ nhập vào số N = 12, thì kết quả ...
Python get timestamp with timezone
Right now I useimport datetime print[datetime.datetime.now[].strftime[%X]] to display the current time as a string. Problem is, my computer is running in Europe/Berlin time zone, and the offset of ...
Hướng dẫn 3d scatter plot python
View DiscussionImprove ArticleSave ArticleReadDiscussView DiscussionImprove ArticleSave ArticleA 3D Scatter Plot is a mathematical diagram, the most basic version of three-dimensional plotting used ...
Python join array to string
The string join[] method returns a string by joining all the elements of an iterable [list, string, tuple], separated by the given separator.Exampletext = [Python, is, a, fun, programming, ...
How do you write a power equation in python?
In today’s modern times, Python is undoubtedly one of the most prominent and popular programming languages out there. Python comes with a host of different functions each built specifically to add ...
Hướng dẫn dùng python else python
Lệnh if trong python được sử dụng để kiểm tra giá trị dạng boolean của điều kiện. Lệnh này trả về giá trị True hoặc False . Có các kiểu của Lệnh if-else ...
Hướng dẫn dùng handling syn python
Until now error messages haven’t been more than mentioned, but if you have tried out the examples you have probably seen some. There are [at least] two distinguishable kinds of errors: syntax ...
Split integer into digits python recursion
How would you split up the number 123456789 into [1,2,3,4,5,6,7,8,9] using Python? Alex Riley157k44 gold badges249 silver badges229 bronze badges asked Jan 20, 2015 at 23:10 0One way is to turn the ...
Hướng dẫn distfit python
distfit - Probability density fitting distfit is a python package for probability density fitting across 89 univariate distributions to non-censored data by residual sum of squares [RSS], ...
Hướng dẫn dùng true vale python
Hàm Dictionary values[] trong Python trả về tất cả các value của một Dictionary.Nội dung chínhDẫn nhậpGiới thiệu về Set trong PythonCách khởi tạo SetSử dụng ...
Hướng dẫn dùng scipy stats python
Thư viện SciPy trong Python là gì?Là phần mềm nguồn mở miễn phí của Python cho toán học, khoa học và kỹ thuật . Thư viện SciPy được xây dựng dựa trên thư ...
Hướng dẫn dùng np devide python
Python NumPy divide[] được sử dụng để chia hai mảng có cùng hình dạng hoặc chia một mảng với một giá trị số duy nhất. Hàm này cung cấp một số tham số cho ...